Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

IL2CPP build error, missing libatomic.a

Discussion in 'Android' started by Ejstn, Nov 30, 2019.

  1. Ejstn

    Ejstn

    Joined:
    Oct 7, 2017
    Posts:
    2
    Hi, I am building android app bundle on unity 2019.2.14f1 with bundled ndk - r16b, with this configuration: upload_2019-11-30_15-27-26.png
    and I am getting following error:

    Failed running C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARMv7" --configuration="Release" --outputpath="C:\Users\Martin Soukup\Documents\babis\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so" --cachedirectory="C:\Users\Martin Soukup\Documents\babis\Assets\..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\bdwgc/include" --additional-include-directories="C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\libil2cpp/include" --tool-chain-path="C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b" --profiler-report --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory="C:/Users/Martin Soukup/Documents/babis/Temp/StagingArea/assets/bin/Data/Managed" --generatedcppdir="C:/Users/Martin Soukup/Documents/babis/Temp/StagingArea/Il2Cpp/il2cppOutput"

    stdout:
    Building libil2cpp.so with AndroidToolChain
    Output directory: C:\Users\Martin Soukup\Documents\babis\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a
    Cache directory: C:\Users\Martin Soukup\Documents\babis\Library\il2cpp_android_armeabi-v7a\il2cpp_cache
    ObjectFiles: 266 of which compiled: 0
    Total compilation time: 240 milliseconds.
    il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @"C:\Users\Martin Soukup\AppData\Local\Temp\tmpCDCA.tmp" -o "C:\Users\Martin Soukup\Documents\babis\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_C1C6CC4701FB0A04EBDD03269E4A054A\libil2cpp.so" -shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id --sysroot "C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\platforms\android-16\arch-arm" -gcc-toolchain "C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64" -target armv7-none-linux-androideabi -Wl,--wrap,sigaction -L "C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a" -lgnustl_static -latomic -llog -rdynamic -fuse-ld=gold.exe

    C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld.gold.exe: error: cannot open C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/lib/../lib/armv7-a/libatomic.a: No such file or directory
    clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)


    v Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
    v Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    v il2cpp.Program.DoRun(String[] args)
    v il2cpp.Program.Run(String[] args)
    v il2cpp.Program.Main(String[] args)
    stderr:

    Neo�et�en� v�jimka: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @"C:\Users\Martin Soukup\AppData\Local\Temp\tmpCDCA.tmp" -o "C:\Users\Martin Soukup\Documents\babis\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_C1C6CC4701FB0A04EBDD03269E4A054A\libil2cpp.so" -shared -Wl,-soname,libil2cpp.so -Wl,--no-undefined -Wl,-z,noexecstack -Wl,--gc-sections -Wl,--build-id --sysroot "C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\platforms\android-16\arch-arm" -gcc-toolchain "C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64" -target armv7-none-linux-androideabi -Wl,--wrap,sigaction -L "C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a" -lgnustl_static -latomic -llog -rdynamic -fuse-ld=gold.exe

    C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld.gold.exe: error: cannot open C:\Program Files\Unity\Hub\Editor\2019.2.14f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/lib/../lib/armv7-a/libatomic.a: No such file or directory
    clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)


    v Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
    v Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    v il2cpp.Program.DoRun(String[] args)
    v il2cpp.Program.Run(String[] args)
    v il2cpp.Program.Main(String[] args)

    UnityEngine.Debug:LogError(Object)
    UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:126)
    UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:71)
    UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:503)
    UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:484)
    UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
    UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun() (at C:/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:122)

    The only clue for me is libatomic.a: No such file or directory , a file missing, but I dont know what to do since I didnt mess with bundled ndk, I just added ndk with instalation through unity hub
     
  2. Ejstn

    Ejstn

    Joined:
    Oct 7, 2017
    Posts:
    2
  3. Kristapsmadeapp

    Kristapsmadeapp

    Joined:
    Jul 10, 2019
    Posts:
    7

    Hi!
    Glad you found solution - I also found one.
    I had exactly the same error.
    After unity update when I tried to compile 64bit Unity showed that it cannot find NDK, so I unchecked "Android NDK Installed with Unity"
    It showed path:

    C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK

    I checked folder path and saw that NDK has one more folder: /android-ndk-r16b
    So I added it at the end of path.

    Unity now found NDK but threw an error exactly like yours.

    I copied folder content from
    C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b

    to upper folder:
    C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/

    and CHECKED "Android NDK Installed with Unity" under Preferences and now all is working again!
     
    PiFLYON, RiccardoAxed, almosr and 4 others like this.
  4. lsierra12

    lsierra12

    Joined:
    Nov 26, 2017
    Posts:
    5
    Dude i owe you my life, have been dealing with this issue the whole day and this is the only thing that worked, thanks a lot!!
     
  5. disturbedUKR

    disturbedUKR

    Joined:
    May 12, 2015
    Posts:
    25
    Moving NDK files helped indeed
     
  6. GreedyVox

    GreedyVox

    Joined:
    Nov 18, 2015
    Posts:
    21
    Thank you sir!, this has fixed all my issues too!

    If you are developing on Linux and having issues building Android NDK with Unity preferences recommended option for NDK, then download NDK and Cmake with Android SDK and link your preferences to those directories.

    install-NDK.png

    Now I can finally build Android Armv7 & Armv64 with Burst using ILCPP.
     
  7. UDN_bf854b32-b089-4b56-887c-0e0e33d6c3cf

    UDN_bf854b32-b089-4b56-887c-0e0e33d6c3cf

    Joined:
    Aug 7, 2017
    Posts:
    5
    This issue is still present with Unity 2019.2.15f1 on Windows.
    As outlined, manually fixing the broken NDK location resolved the issue:

    Hi!
    Glad you found solution - I also found one.
    I had exactly the same error.
    After unity update when I tried to compile 64bit Unity showed that it cannot find NDK, so I unchecked "Android NDK Installed with Unity"
    It showed path:

    C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK

    I checked folder path and saw that NDK has one more folder: /android-ndk-r16b
    So I added it at the end of path.

    Unity now found NDK but threw an error exactly like yours.

    I copied folder content from
    C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/android-ndk-r16b

    to upper folder:
    C:/Program Files/Unity/Hub/Editor/2019.2.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/

    and CHECKED "Android NDK Installed with Unity" under Preferences and now all is working again!
     
  8. consoni

    consoni

    Joined:
    Apr 3, 2018
    Posts:
    3
    I've been stuck with this problem for about 2 days, it started after making the very wrong decision to upgrade Unity to version 2019.2.15, from this moment on things went downhill.
    I tried to reinstall the whole thing and even the version I used before, but nothing else worked.
    Moving NDK Files from (android-ndk-r16b) to ../NDK works.
    Thanks guys, I was losing my mind.
     
  9. thylaxene

    thylaxene

    Joined:
    Oct 10, 2005
    Posts:
    709
    Yeah fixed it for me as well on macOS with 2019.2.14. I mean WTF! Makes me wonder what the point of the Hub is!

    Cheers.
     
  10. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    205
    EDIT: literally solved by unchecking and checking again both Use "Android NDK installed with Unity" and "Use Android SDK installed with Unity". What a comedy.
    ---
    Doesn't work for me. On Unity 2019.2.16f, after moving the files, I get another error:

    Win32Exception: ApplicationName='/Applications/Unity/Hub/Editor/2019.3.0b6/PlaybackEngines/AndroidPlayer/SDK/tools/bin/sdkmanager', CommandLine='--list', CurrentDirectory='/Users/DanjelRicci/ProgettiUnity3D/V-Speedway', Native error= Cannot find the specified file
    System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) (at <ae22a4e8f83c41d69684ae7f557133d9>:0)
    System.Diagnostics.Process.Start () (at <ae22a4e8f83c41d69684ae7f557133d9>:0)
    (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
    UnityEditor.Utils.Program.Start (System.EventHandler exitCallback) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Utils/Program.cs:44)
    UnityEditor.Utils.Program.Start () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Utils/Program.cs:28)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.SDKManager.UpdatePackagesList () (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.SDKManager.HighestVersionInstalled (UnityEditor.Android.SDKManager+Component tool) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKToolsDetector.GetVersion () (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector detector) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTarget target) (at <21da158cd428404389e0b5a08ba9ea0a>:0)
    UnityEditor.PostprocessBuildPlayer.PrepareForBuild (UnityEditor.BuildOptions options, UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:106)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
     
    Last edited: Dec 15, 2019
  11. Kristapsmadeapp

    Kristapsmadeapp

    Joined:
    Jul 10, 2019
    Posts:
    7
    It seems like they partly fixed the issue in version 2019.2.17f1 ..
    I had only uncheck then click once browse (so in path "/2019.2.16f1/" changes to "/2019.2.17f1/") -> and check again check boxes under preferences - > External Tools (for JDK, NDK, SDK)
     
unityunity