NDK related build failure

I have been getting an extremely frustrating error with no recourse when attempting to build for android for several months. This is when trying to build for IL2CPP, for an arm64 build.

Building Library\Bee\artifacts\Android\87lik\jhbi5e2fvizf.o failed with output
[[GARBAGE]]
I will figure out how to post the full info and add that, but the information is completely useless.

I have seen this error pop up a lot of places, with tons of different solutions, and none of them work for me. I have tried multiple versions, 2022.3.10f1, 2022.3.50f1, 2022.3.26f1, a 2020 version. I have reinstalled several times. I have tried creating fresh projects and even empty projects fail. It used to work on this machine without a problem, and it still works on the same version with the same project on my laptop. I have tried manually specifying the NDK and Unity does not allow you to use any other NDK version

Please ask me any questions, any info I can get you so I can do to solve this. I have spent about 20 hours on this and I am going insane : )

Error:

Building Library\Bee\artifacts\Android\87lik\jhbi5e2fvizf.o failed with output:
PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: "C:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++" -march=armv8-a -D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ -faddrsig -mllvm -hoist-common-insts=1 -DANDROID -DHAVE_INTTYPES_H -no-canonical-prefixes -funwind-tables -fstack-protector -fomit-frame-pointer -std=c++11 -Wswitch -Wno-trigraphs -Wno-tautological-compare -Wno-invalid-offsetof -Wno-implicitly-unsigned-literal -Wno-integer-overflow -Wno-shift-negative-value -Wno-unknown-attributes -Wno-implicit-function-declaration -Wno-null-conversion -Wno-missing-declarations -Wno-unused-value -Wno-pragma-once-outside-header -fvisibility=hidden -fexceptions -fno-rtti -g -Os -fPIC -fno-strict-overflow -ffunction-sections -fdata-sections -fmessage-length=0 -pipe -D_GLIBCXX_USE_CXX11_ABI=0 -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DIL2CPP_MONO_DEBUGGER_DISABLED -DRUNTIME_IL2CPP -DTARGET_ARM64 -DIL2CPP_ENABLE_WRITE_BARRIERS=1 -DIL2CPP_INCREMENTAL_TIME_SLICE=3 -DGC_NOT_DLL -DIL2CPP_DEFAULT_DATA_DIR_PATH=Data -DNDEBUG -I. "-IC:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/il2cpp/external/bdwgc/include" "-IC:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/il2cpp/libil2cpp/pch" "-IC:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/il2cpp/libil2cpp" "-IC:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/il2cpp/external/baselib/Include" "-IC:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/il2cpp/libil2cpp/os/ClassLibraryPAL/brotli/include" "-IC:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/il2cpp/external/baselib/Platforms/Android/Include" -o Library/Bee/artifacts/Android/87lik/jhbi5e2fvizf.o -fcolor-diagnostics -fdiagnostics-absolute-paths -target aarch64-linux-android22 -fstrict-aliasing -fdiagnostics-format=msvc -c -x c++ Library/Bee/artifacts/Android/87lik/aw5bbnh42foh1.lump.cpp
1.	<eof> parser at end of file
2.	Code generation
 #0 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x37ffba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x7cd061
 #1 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x7cd151 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x7cd151
 #2 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x7cd151 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x2b22a70
 #3 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x165d259 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x75800a
 #4 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x241011 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x23b4f2
 #5 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x127d1e1 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x15d8683
 #6 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x2914b13 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x1540374
 #7 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x6c9da0 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x744473
 #8 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x6482 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x4661
 #9 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x1354156 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x577d11
#10 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x1353bf4 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x692424
#11 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x692809 C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x6a5786
#12 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x3dcd C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x1395
#13 0x00007ff66e9effba C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe 0x14c8 (C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x37ffba)
#14 0x00007ff66e9effba 
#15 0x00007ff66e9effba (C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x37ffba)
0x00007FF66E9EFFBA (0x00000249CE469B10 0x0000000000000000 0x0000009EEA1FB470 0x00007FF66EFDC10D)
0x00007FF66EE3D061 (0x0000009EEA1FB5A0 0x0000000000000000 0x0000000000000008 0x0000009EEA1FB568)
0x00007FF66EE3D151 (0x00000249CE469B10 0x0000000000000000 0x0000009EEA1FB6D0 0x00007FF66EFDC10D)
0x00007FF66EE3D151 (0x00000249D0088F40 0x00007FF66E9EFCBC 0x0000000000000000 0x00007FF66EDBFCCE)
0x00007FF66EE3D151 (0x00000249D073D7B8 0x00000249D073D7C0 0x00000249CE469B10 0x00007FF66FDCE86B)
0x00007FF671192A70 (0x00000249CB979D30 0x00007FFCB1B21966 0x0000000000000000 0x0000000000000020)
0x00007FF66FCCD259 (0x00000249CB724500 0x00000249D0AE5730 0x00000249D10CF29F 0x00007FF66F83D1E9)
0x00007FF66EDC800A (0x00000249CFFD3ED0 0x0000009EEA1FBD60 0x000000000000000B 0x00000249CEE3C6F0)
0x00007FF66E8B1011 (0x0000001000000000 0x0000024900000000 0x00000249D062B328 0x00007FFCB414C330)
0x00007FF66E8AB4F2 (0x0000000000000000 0x0000000000000000 0x00000249CD9AB4A0 0x0000000000000000)
0x00007FF66F8ED1E1 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF66FC48683 (0x0000009EEA1FD3B0 0x0000009EEA1FD3A0 0x0000009EEA1FD380 0x00007FF66ED3798A)
0x00007FF670F84B13 (0x00000249CB9351D0 0x0000000800000003 0x0000000900000000 0x000000020000000A)
0x00007FF66FBB0374 (0x00000249CB934AF0 0x0000042A00000429 0x000014DA0000042B 0x0000169F0000156C)
0x00007FF66ED39DA0 (0x00000249CB925E60 0x0000009E00000000 0x0000009EEA1FDCD0 0x00000249CB8EB820)
0x00007FF66EDB4473 (0x0000000000000004 0x00007FF66EDB9949 0x0000009EEA1FD8A8 0x00007FF66EDB97AB)
0x00007FF66E676482 (0x00000249CB890000 0x0000000000000002 0x00000000FFFFFFFF 0x00007FFCB4114DF6)
0x00007FF66E674661 (0x0000009EEA1FDE68 0x00000249CB92B4F0 0x0000009EEA1FDE68 0x00000249CB92B4F0)
0x00007FF66F9C4156 (0x00000249CB92B4F0 0x00000249CB92B4F0 0x00000249CB92A650 0x00007FF66EC39620)
0x00007FF66EBE7D11 (0x00000249CB890000 0x0000009E25001237 0x00000249CB92B500 0x0000024902000002)
0x00007FF66F9C3BF4 (0x00000249CB7202A4 0x0000000000000010 0x00000249CB720CC0 0x0000009EEA1FE399)
0x00007FF66ED02424 (0x00000249CB8F0781 0x00000249CB92A8B0 0x0000000000000085 0x00000249CB89DDD0)
0x00007FF66ED02809 (0x00000249CB8C0090 0x00000249CB8C0090 0x0000009EEA1FE450 0x0000009EEA1FE450)
0x00007FF66ED15786 (0x0000009EEA1FE6E0 0x00007FFC00000000 0x00007FFC00200000 0x0000009EEA1FE580)
0x00007FF66E673DCD (0x0000000000000041 0x0000000000000000 0x00007FFCB27D8650 0x0000000000000000)
0x00007FF66E671395 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF66E6714C8 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FFCB27D257D (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x1D bytes(s)
0x00007FFCB416AF08 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x28 bytes(s)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Android (7714059, based on r416183c1) clang version 12.0.8 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)
Target: aarch64-unknown-linux-android22
Thread model: posix
InstalledDir: C:/Program Files/Unity/Hub/Editor/2022.3.10f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin
clang++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: C:\Users\Michael\AppData\Local\Temp\aw5bbnh42foh1-316cfa.cpp
clang++: note: diagnostic msg: C:\Users\Michael\AppData\Local\Temp\aw5bbnh42foh1-316cfa.sh
clang++: note: diagnostic msg: 

********************

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I can’t upload attachments as a new user, but this is a link to my editor.log file:

Sorry, that you’re having these issues. Since it’s related to NDK compiler crashing, it’s hard for us to fix the actual problem, besides hoping that it will be fixed in future NDK updates.

In any case, by differently generating cpp code, these issues can be sometimes fixed, things to try:

  • Do you have Scripting Debugging enabled? If so, try disabling
  • Try changing Il2CPP C++ Configuration in Player Settings

Thank you for the suggestions.
Script debugging is disabled
Changing from IL2CPP to Mono builds, but I need it to be IL2CPP to make it arm64 and be able to upload to the google play store.

You say it’s hard to fix because it’s related to the NDK compiler crashing, could you explain more?

This doesn’t seem like a hugely common issue or I’d hear about it more, and Unity forces me to use a specific NDK, so a workaround there might fix it? We can’t really be reliant on Android changing something to have a fix here right? I’m at the point where I am wondering if there is some issue with my machine because it works fine on my laptop :confused:

The Android NDK is not managed by Unity, it comes from Google, and I am not sure where Google takes clang from.

Did you try changing IL2CPP C++ Configuration in Player Settings?

That makes sense

Oh I see, so there is master, release, and debug, that is what you mean right?
It fails for all 3 with the same error.

As I’ve done a full reinstall, is there any other sort of settings or information that would persist beyond a full reinstall that I can try to delete?

Maybe try this, in the log, it mentions

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: C:\Users\Michael\AppData\Local\Temp\aw5bbnh42foh1-316cfa.cpp
clang++: note: diagnostic msg: C:\Users\Michael\AppData\Local\Temp\aw5bbnh42foh1-316cfa.sh
clang++: note: diagnostic msg: 

Try checking the contents of that cpp file, and see if you can connect to the C# file which was used for generating this file. In some cases, the problem is related to something unusual being generated, like array being initialized with million entries, or having insanely large function, etc.

unfortunately nothing in the file means anything to me, I’m not sure how to find that C# file. I am doing this on a new project so I don’t think it can be any issues like that in my code. It looks like a very large file with no obvious errors

Yes, i don’t see anything unusual too.

Here’s one more thing to try.

You could export a gradle project and open it from Android Studio and build from there. In theory it should fail the same way, but maybe with bit of luck, it will succeed.

But also, there’s another thing, in unityLibrary/build.gradle NDK path is set, in theory you could reroute to a different NDK and it might fix your issue, but this is intested path, so not sure if it will work.

Just want to mention we are seeing this too, even with the latest 2022 LTS at this time (2022.3.53f1).

What is very odd is that if you repeat the build, you will get different errors, but eventually one will work.

I haven’t tried Tomas’s latest suggestion yet, been a bit busy with work and fixing up “real” problems on my laptop which doesn’t have this error.

I did want to add that yes, the exact error IS different every time. But I’ve had about 25 failed builds in a row so I have yet to get lucky. Maybe they need to be closer together? Idk…