Search Issue Tracker

Won't Fix

Votes

1

Found in

2019.2.0a9

Issue ID

1150223

Regression

No

[Android] [IL2CPP] Flag --long-plt is missing when building a release build (Error: PLT offset too large, try with --long-plt)

Android

-

Link error "android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold: error: PLT offset too large, try linking with --long-plt" is shown when building a release build wih 2019.1.0a9" is shown when making a release build with Unity 2019.2.0a9.

This issue only occurs for Android release builds. We are not sure if --long-plt was removed in 2019 or there is a different issue causing the error.

Request: please add a flag --long-plt

Steps:
1. Download and open project from ownCloud (see edit)
2. Switch to Android
3. In menu bar: Build > Select Configuration
4. Choose or make sure it's using Development Bundle
5. Click Code Only
6. Wait 5-60 minutes

Result: After some time building assetbundles, it finally get to the linking phase and will fail showing this message:
android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.gold: error: PLT offset too large, try linking with --long-plt

Reproduced with: 2019.2.0a9
Not reproduced with: 2020.1.0a25 (due to errors in Console), 2019.3.2f1 (due to errors in Console), 2018.4 and earlier (due to errors in Console)

WORKAROUND: add the following line at the top of BuildCodeAndRun() in AndroidUtils.cs:
PlayerSettings.SetAdditionalIl2CppArgs("--command-log=on --linker-flags=\"-Wl,--long-plt\"");

  1. Resolution Note:

    The workaround of:
    PlayerSettings.SetAdditionalIl2CppArgs("--command-log=on --linker-flags=\"-Wl,--long-plt\"");

    is the way to do it. Note, that the linker used by Unity depends on Unity version and ARMv7 vs ARM64, the bfd linker does not have --long-plt option.

Comments (1)

  1. Flexford

    Dec 06, 2022 11:21

    Also it's can be when you build IL2CPP with build option 'allowDebugging'

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.