Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Android build Burst compiler (1.8.7) failed running.

Discussion in 'Burst' started by JulianNeil, Aug 1, 2023.

  1. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49
    I recently attempted to upgrade a smallish 2D game project from 2021.3 to 2022.3.
    I have it working in the editor, but when I try to build for android I get the below errors. Unfortunately I'm not sure where to look to resolve this. Any help would be appreciated.


    Library/Bee/artifacts/Android/AsyncPluginsFromLinker: Burst internal compiler error: Burst.Compiler.IL.Aot.AotLinkerException: Non 0 exit code | The native link step failed. Check previous exception in the log - linker command line : "/home/jules/Unity/Hub/Editor/2022.3.5f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang '@/tmp/tmp193392c5.tmp'"
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /home/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)


    Building Library/Bee/artifacts/Android/AsyncPluginsFromLinker failed with output:
    UnityEditor.Build.BuildFailedException: Burst compiler (1.8.7) failed running
    stdout:
    Starting 1 library requests
    Error: Burst internal compiler error: Burst.Compiler.IL.Aot.AotLinkerException: Non 0 exit code | The native link step failed. Check previous exception in the log - linker command line : "/home/jules/Unity/Hub/Editor/2022.3.5f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang '@/tmp/tmp193392c5.tmp'"
    at Burst.Compiler.IL.Aot.AotNativeLinkBase.RunNativeLinkerTool (System.String command, System.String arguments, System.String errorMessage, System.String commandType, System.String workingDirectory, Burst.Compiler.IL.Aot.AotNativeLinkBase+AotNativeLinkerConsoleOutput consoleOutput) [0x000f8] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Aot.AotNativeLinkAndroid.Link (Burst.Backend.TargetCpu targetCpu, System.Collections.Generic.List`1[T] inputFiles, System.String outputFile, System.Boolean enableDebugInfo) [0x000cd] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Aot.AotCompiler.Link (System.Collections.Generic.List`1[T] groups, System.String nameSuffix, Burst.Compiler.IL.Aot.AotCompilerOptions compilerOptions, System.IO.TextWriter consoleOut, System.IO.TextWriter consoleError) [0x0023f] in <532a8a169e6a4953b5d9a4c213b71772>:0
    at Burst.Compiler.IL.Server.LibraryCompiler.LinkAndFinalize (Burst.Compiler.IL.Server.CompilationJob request, Burst.Compiler.IL.Server.SharedLibraryCompilationState sharedState, System.Int32 methodGroupIndex, Burst.Compiler.IL.NativeCompiler nativeCompiler, Burst.Compiler.IL.Aot.AotCompilerOptions defaultOptions, Burst.Compiler.IL.Aot.AotModuleGroup aotModuleGroup) [0x007be] in <532a8a169e6a4953b5d9a4c213b71772>:0
    stderr:
    at Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) [0x001f7] in ./Library/PackageCache/com.unity.burst@1.8.7/Editor/BurstAotCompiler.cs:1705
    at Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) [0x0003f] in ./Library/PackageCache/com.unity.burst@1.8.7/Editor/BurstAotCompiler.cs:1582
    at Unity.Burst.Editor.BurstAotCompiler+BclRunner.RunManagedProgram (System.String exe, System.String args, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) [0x00000] in ./Library/PackageCache/com.unity.burst@1.8.7/Editor/BurstAotCompiler.cs:1557
    at Unity.Burst.Editor.BurstAotCompiler.OnPostBuildPlayerScriptDLLsImpl (Unity.Burst.Editor.BurstAotCompiler+BurstAOTSettings settings, UnityEditor.Compilation.Assembly[] playerAssemblies) [0x00914] in ./Library/PackageCache/com.unity.burst@1.8.7/Editor/BurstAotCompiler.cs:705
    at Unity.Burst.Editor.BurstAOTCompilerPostprocessor.DoGenerate (UnityEditor.Compilation.Assembly[] assemblies) [0x00013] in ./Library/PackageCache/com.unity.burst@1.8.7/Editor/BurstAotCompiler.cs:265
    at Unity.Burst.Editor.BurstAOTCompilerPostprocessor.GenerateNativePluginsForAssemblies (UnityEditor.Build.IGenerateNativePluginsForAssemblies+GenerateArgs args) [0x0007d] in ./Library/PackageCache/com.unity.burst@1.8.7/Editor/BurstAotCompiler.cs:179
    at UnityEditor.Modules.BeeBuildPostprocessor.GenerateNativePluginsForAssemblies (PlayerBuildProgramLibrary.Data.GenerateNativePluginsForAssembliesArgs args) [0x00050] in /home/bokken/build/output/unity/unity/Editor/Mono/Modules/BeeBuildPostprocessor.cs:605
    at Bee.BeeDriver.BuildRequest+<>c__DisplayClass63_0`1[T].<RegisterRPCCallback>b__0 (System.Object o) [0x00000] in /home/bokken/build/output/unity/unity/Tools/Bee/Bee.BeeDriver2/BuildRequest.cs:66
    at Bee.BeeDriver.BeeDriver_RunBackend+<>c__DisplayClass1_0.<ProcessRPCRequest>b__0 () [0x00000] in /home/bokken/build/output/unity/unity/Tools/Bee/Bee.BeeDriver2/BeeDriver_RunBackend.cs:88
    at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <bb088ab5ef6b437f85ed9cbe6066127e>:0
    at System.Threading.Tasks.Task.Execute () [0x00000] in <bb088ab5ef6b437f85ed9cbe6066127e>:0
    --- End of stack trace from previous location where exception was thrown ---
    at Bee.BeeDriver.BeeDriver_RunBackend.ProcessRPCRequest (Bee.BinLog.RPCActionMessage msg, Bee.BeeDriver.BuildRequest+RPCCallback rpcCallback, IPCConnection ipcConnection, System.Threading.Tasks.Task writePipeConnectionTask, Bee.BeeDriver.InternalState state) [0x000ba] in /home/bokken/build/output/unity/unity/Tools/Bee/Bee.BeeDriver2/BeeDriver_RunBackend.cs:88 (��Y
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&) (at /home/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)
     
  2. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    280
    Hi @JulianNeil - the actual error message will be above that in the editor logfile. Please could you attach your editor log, or if you're not comfortable doing that in a public thread, please could you submit a bug report?
     
  3. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49
    When you say "above that", what am I looking above exactly? I'm trying to identify the relevant info in the log but I'm having trouble.. Failing that - what in the log do I need to redact before posting? Unfortunately submitting the whole project in a bug report is not an option.
     
  4. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49
    Hi @tim_jones, and thanks in advance for your help. I cleared the editor log and did another build. Here is the contiguous portion of the Editor.log that contains stack traces. There are no other stack traces in the log. Is that helpful at all?
     

    Attached Files:

  5. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    280
    Thanks. I can't see any actionable error message in there - perhaps it's not actually being output in the editor log.

    After you get that error (and without closing the editor) could you try, from a terminal window, running the command line that it mentions? For example in the logfile above it's

    /home/jules/Unity/Hub/Editor/2022.3.5f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang '@/tmp/tmp560f4141.tmp'
     
  6. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49
    Hi @tim_jones. Taking the failed command - and trying from the command line (I'm on linux) gave:


    jules@xxxx:~$ export PATH="/home/jules/Unity/Hub/Editor/2022.3.5f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH"
    jules@xxxx:~$ which clang
    /home/jules/Unity/Hub/Editor/2022.3.5f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin//clang
    jules@xxxx:~$ clang '@/tmp/tmp21fc40b6.tmp'
    clang-12: error: no input files
    jules@xxxx:~$ clang '/tmp/tmp21fc40b6.tmp'
    clang-12: error: no input files

    I'm very familiar with linux shell scripting, but '@/tmp/tmp21fc40b6.tmp' is a bit mysterious.. I'm not across how unity manages scripting the build - but I would assume it uses mono. I am not at all familiar with windows scripting. Assuming that it is trying to use the contents of the file /tmp/tmp560f4141.tmp as command line arguments, I tried (without any luck):

    jules@xxxx:~$ xargs < /tmp/tmp21fc40b6.tmp clang
    clang-12: error: no input files

    So then I'm wondering what clang does..

    jules@xxxx:~$ cat /home/jules/Unity/Hub/Editor/2022.3.5f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
    clang-12jules@xxxx:~$

    OK.. thats a little odd. clang is clearly not passing through command line arguments.. It doesn't even have an EOL. Perhaps something to do with how windows runs scripts.. So I tried clang-12 directly.

    jules@xxxx:~$ xargs < /tmp/tmp21fc40b6.tmp clang-12

    This executed without a problem, and generated the expected .so without failure..
    So now I am not sure where to go.. Any advice?
     
    Last edited: Aug 3, 2023
  7. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    280
    @JulianNeil thanks for trying that! I'm wondering what happens if you do

    clang @'/tmp/tmp21fc40b6.tmp'


    e.g. put the @ character outside the quotes.
     
  8. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49

    jules@xxxx:~$ clang @'/tmp/tmp21fc40b6.tmp'
    clang-12: error: no input files
    jules@xxxx:~$ clang-12 @'/tmp/tmp21fc40b6.tmp'
    jules@xxxx:~$


    Hi @tim_jones. clang still doesn't pass through the arguments.. but clang-12 works.. You learn something new every day! I never knew that you could do that with an @ - and I've been coding and using unix for around 35 years!

    Edit - I spoke too soon.. must be a clang-12 thing.. Doesn't work for general linux commands.
     
    Last edited: Aug 3, 2023
  9. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    280
  10. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49
    Cool. thanks @tim_jones.
    In the meantime, I got the build to succeed by modifying the scripting as follows, and then running the build as normal:

    cd ~/Unity/Hub/Editor/2022.3.5f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/
    mv clang clang.old
    mv clang++ clang++.old
    ln -s clang clang++
    ln -s clang-12 clang


    [Edit] There are probably some other candidates in that bin directory for symbolic links under linux. I noticed that in 2021.3 the executables were copied rather than using the unusual linking in 2022.3, as shown in the following listing of
    ~/Unity/Hub/Editor/2021.3.29f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/

    -rwxr-xr-x 1 jules jules 84141568 Aug 1 12:42 clang
    -rwxr-xr-x 1 jules jules 84141568 Aug 1 12:42 clang++
     
    Last edited: Aug 3, 2023
    tim_jones likes this.
  11. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49
    Hi @tim_jones .
    In official linux llvm releases, commands like "clang" ship as symbolic links.
    I notice that the bundled llvm is 12.0.8 - which was likely built from git (as there is no official 12.0.8 release).

    But now I think I'm just yak shaving.. so I'll get back to game coding..
     
  12. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    280
  13. JulianNeil

    JulianNeil

    Joined:
    Jun 27, 2022
    Posts:
    49