Cannot build IL2CPP to Android

hi!

Can’t Android il2cpp build on macOS Catalina

I am using Unity 2019.4.12f1 with Android SDK and NDK build tools installed.

How can we fix this?

The build fails with 2 errors (Log below)


DisplayProgressbar: IL2CPP
DisplayProgressbar: Building Player
Invoking UnityLinker with arguments: -out=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/tempStrip” -x=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/…/platform_native_link.xml” -x=“/var/folders/d9/db62p33x7xj3g5vthvxprkzm0000gn/T/tmp6af800c6.tmp” -x=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/TypesInScenes.xml” -x=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Assets/link.xml” -x=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Assets/Scripts/NGameObject/NToy/link.xml” -d=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed” --include-unity-root-assembly=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/Assembly-CSharp-firstpass.dll” --include-unity-root-assembly=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/Assembly-CSharp.dll” --include-unity-root-assembly=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/Tapjoy.dll” --include-unity-root-assembly=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/I18N.CJK.dll” --include-unity-root-assembly=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/I18N.dll” --dotnetruntime=il2cpp --dotnetprofile=unityaot --use-editor-options --include-directory=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed” --editor-settings-flag=AllowDebugging --editor-settings-flag=Development --rule-set=Conservative --editor-data-file=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed/EditorToUnityLinkerData.json” --platform=Android --enable-engine-module-stripping --engine-stripping-flag=EnableUnityConnect --engine-modules-asset-file=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/Whitelists/…/modules.asset”
/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/build/deploy/net471/UnityLinker.exe exited after 68092 ms.
/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe exited after 194 ms.
Invoking il2cpp with arguments: --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile=“unityaot” --compile-cpp --libil2cpp-static --platform=“Android” --architecture=“ARMv7” --configuration=“Release” --outputpath=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Native/armeabi-v7a/libil2cpp.so” --cachedirectory=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Assets/…/Library/il2cpp_android_armeabi-v7a/il2cpp_cache” --additional-include-directories=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include” --additional-include-directories=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include” --tool-chain-path=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK” --enable-debugger --profiler-report --map-file-parser=“/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/Tools/MapFileParser/MapFileParser” --directory=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Managed” --generatedcppdir=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/Il2Cpp/il2cppOutput”
/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/build/deploy/il2cppcore/il2cppcore.dll exited after 263596 ms.
DisplayProgressbar: IL2CPP
Invoking il2cpp with arguments: --compile-cpp --libil2cpp-static --platform=“Android” --architecture=“ARM64” --configuration=“Release” --outputpath=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Native/arm64-v8a/libil2cpp.so” --cachedirectory=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Assets/…/Library/il2cpp_android_arm64-v8a/il2cpp_cache” --additional-include-directories=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include” --additional-include-directories=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include” --tool-chain-path=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK” --map-file-parser=“/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/Tools/MapFileParser/MapFileParser” --generatedcppdir=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/Il2Cpp/il2cppOutput” --dotnetprofile=“unityaot” --enable-debugger
/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/build/deploy/il2cppcore/il2cppcore.dll exited after 314630 ms.

Error 1 :

Exception: /Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/build/deploy/il2cppcore/il2cppcore.dll did not run properly!
Failed running “/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/build/deploy/il2cppcore/il2cppcore.dll” --compile-cpp --libil2cpp-static --platform=“Android” --architecture=“ARM64” --configuration=“Release” --outputpath=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Native/arm64-v8a/libil2cpp.so” --cachedirectory=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Assets/…/Library/il2cpp_android_arm64-v8a/il2cpp_cache” --additional-include-directories=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include” --additional-include-directories=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include” --tool-chain-path=“/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK” --map-file-parser=“/Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/Tools/MapFileParser/MapFileParser” --generatedcppdir=“/Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/Il2Cpp/il2cppOutput” --dotnetprofile=“unityaot” --enable-debugger

stdout:
Building libil2cpp.so with AndroidToolChain
Output directory: /Users/xxx/Jenkins/workspace/xxx/MyProject/Temp/StagingArea/assets/bin/Data/Native/arm64-v8a
Cache directory: /Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache

il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ @“/var/folders/d9/db62p33x7xj3g5vthvxprkzm0000gn/T/tmpsjjuvo.tmp” -o “/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/linkresult_1931B874F610CB1490A5CA338E2E1E5F/libil2cpp.so” -shared -Wl,-soname,libil2cpp.so -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id -stdlib=libc++ -static-libstdc++ -target aarch64-linux-android21 -Wl,–wrap,sigaction -llog -rdynamic -fuse-ld=bfd

/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function AndroidLogCallback(char const*)': /Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/libil2cpp/os/Android/Initialize.cpp:12:(.text._ZL18AndroidLogCallbackPKc+0x18): relocation truncated to fit: R_AARCH64_JUMP26 against symbol __android_log_print’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/liblog.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function il2cpp::hushed:s::OpenAndroidConfig()': /Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/libil2cpp/os/Android/TimeZoneInfo.cpp:48:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x1c): relocation truncated to fit: R_AARCH64_CALL26 against symbol getenv@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::char_traits<char>::length(char const*)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/__string:217:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x50): relocation truncated to fit: R_AARCH64_CALL26 against symbol strlen@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function il2cpp::hushed:s::OpenAndroidConfig()': /Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/libil2cpp/os/Android/TimeZoneInfo.cpp:49:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x88): relocation truncated to fit: R_AARCH64_CALL26 against symbol getenv@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::__libcpp_allocate(unsigned long, unsigned long)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/new:259:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x9c): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator new(unsigned long)’ defined in .text._Znwm section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::char_traits<char>::length(char const*)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/__string:217:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0xd0): relocation truncated to fit: R_AARCH64_CALL26 against symbol strlen@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x114): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator delete(void*)’ defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x124): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator delete(void*)' defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o) /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x18c): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator delete(void*)’ defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x1c4): relocation truncated to fit: R_AARCH64_CALL26 against symbol `operator delete(void*)’ defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x1ec): additional relocation overflows omitted from the output
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Program.DoRun(String[ ] args, List1 foundAssemblies)
at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[ ] args)
stderr:

Error 2:

Unhandled Exception: Unity.IL2CPP.Building.BuilderFailedException:

/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ @“/var/folders/d9/db62p33x7xj3g5vthvxprkzm0000gn/T/tmpsjjuvo.tmp” -o “/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/linkresult_1931B874F610CB1490A5CA338E2E1E5F/libil2cpp.so” -shared -Wl,-soname,libil2cpp.so -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id -stdlib=libc++ -static-libstdc++ -target aarch64-linux-android21 -Wl,–wrap,sigaction -llog -rdynamic -fuse-ld=bfd
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function AndroidLogCallback(char const*)': /Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/libil2cpp/os/Android/Initialize.cpp:12:(.text._ZL18AndroidLogCallbackPKc+0x18): relocation truncated to fit: R_AARCH64_JUMP26 against symbol __android_log_print’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/liblog.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function il2cpp::hushed:s::OpenAndroidConfig()': /Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/libil2cpp/os/Android/TimeZoneInfo.cpp:48:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x1c): relocation truncated to fit: R_AARCH64_CALL26 against symbol getenv@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::char_traits<char>::length(char const*)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/__string:217:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x50): relocation truncated to fit: R_AARCH64_CALL26 against symbol strlen@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function il2cpp::hushed:s::OpenAndroidConfig()': /Applications/Unity/Hub/Editor/2019.4.12f1/Unity.app/Contents/il2cpp/libil2cpp/os/Android/TimeZoneInfo.cpp:49:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x88): relocation truncated to fit: R_AARCH64_CALL26 against symbol getenv@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::__libcpp_allocate(unsigned long, unsigned long)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/new:259:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x9c): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator new(unsigned long)’ defined in .text._Znwm section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::char_traits<char>::length(char const*)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/__string:217:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0xd0): relocation truncated to fit: R_AARCH64_CALL26 against symbol strlen@@LIBC’ defined in .text section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/xxx/Jenkins/workspace/xxx/MyProject/Library/il2cpp_android_arm64-v8a/il2cpp_cache/libil2cpp/ED2CB05F929E77039685BF1849B1DA67.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x114): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator delete(void*)’ defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x124): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator delete(void*)' defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o) /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x18c): relocation truncated to fit: R_AARCH64_CALL26 against symbol operator delete(void*)’ defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x1c4): relocation truncated to fit: R_AARCH64_CALL26 against symbol `operator delete(void*)’ defined in .text._ZdlPv section in /Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/lib/aarch64-linux-android/libc++_static.a(new.o)
/Applications/Unity/Hub/Editor/2019.4.12f1/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/new:340:(.text._ZN6il2cpp2os17OpenAndroidConfigEv+0x1ec): additional relocation overflows omitted from the output
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Program.DoRun(String[ ] args, List1 foundAssemblies)
at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[ ] args)
at Program.Main(String[ ] args) in /Users/bokken/buildslave/unity/build/External/il2cpp/il2cpp/il2cppcore/Program.cs:line 24

at UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) [0x000e3] in /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:126

Got the same problem on build Android project for ARM64 target architecture with Unity 2019.4 and Android NDK 19 installed with Unity.

There is one type of error in the linker ld.bfd call phase:
“In function … relocation truncated to fit … against symbol … defined in .text section in…”

One of the ways for solving the problem is upgrading to Unity 2020 or newer.

In case of using Unity 2019.4 workaround was found in result of some investigaton ld.bfd linker’s source code delivered with Android NDK toolchains.

To build our android project successfully we must set --stub-group-size=N option explicitly for the ld.bfd linker.
(stub-group-size=N is maximum size of a group of input sections that can be handled by one stub section)

By default stub-group-size value used by the linker is equal 127Mb. So we’ve tried to decrease the value a little bit to 125829120 bytes (120Mb) and errors were gone.