When switching to IL2CPP for Android, my build crashes and outputs 3 errors.

Failed running C:\Program Files\Unity\2019.1.9f1\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\christophert\Desktop\Unity\Bayou\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so” --cachedirectory=“C:\Users\christophert\Desktop\Unity\Bayou\Assets..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache” --additional-include-directories=“C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\bdwgc/include” --additional-include-directories=“C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\libil2cpp/include” --tool-chain-path=“C:/Program Files/Unity/2019.1.9f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK” --profiler-report --map-file-parser=“C:/Program Files/Unity/2019.1.9f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe” --directory=C:/Users/christophert/Desktop/Unity/Bayou/Temp/StagingArea/assets/bin/Data/Managed --generatedcppdir=C:/Users/christophert/Desktop/Unity/Bayou/Temp/StagingArea/Il2Cpp/il2cppOutput

stdout:

Building libil2cpp.so with AndroidToolChain

Output directory: C:\Users\christophert\Desktop\Unity\Bayou\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a

Cache directory: C:\Users\christophert\Desktop\Unity\Bayou\Library\il2cpp_android_armeabi-v7a\il2cpp_cache

il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: In file included from C:\Users\christophert\Desktop\Unity\Bayou\Temp\StagingArea\Il2Cpp\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp:72:

In file included from C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity\AtomicQueue.cpp:6:

In file included from C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps.h:121:

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:622:17: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:653:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:690:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:724:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:755:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r0”, “r1”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:793:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:833:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:875:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:917:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

9 errors generated.

Invocation was: Executable: “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK oolchains\llvm\prebuilt\windows-x86_64\bin\clang++”

Arguments: -DNET_4_0 -DUNITY_AOT -DGC_NOT_DLL -DRUNTIME_IL2CPP -DLINUX -DANDROID -DPLATFORM_ANDROID -D__linux__ -D__STDC_FORMAT_MACROS -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\bdwgc\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\libil2cpp\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\external\bdwgc\include" -I"." -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sources\cxx-stl\llvm-libc++\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sources\cxx-stl\llvm-libc++abi\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sources\android\support\include" -c -g -DNDEBUG -fexceptions -fno-limit-debug-info -fdata-sections -ffunction-sections -Wa,–noexecstack -fno-rtti -std=c++98 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-overflow -fPIC -Os --sysroot “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sysroot” -gcc-toolchain “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK oolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64” -target armv7-none-linux-androideabi -isystem “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sysroot\usr\include\arm-linux-androideabi” -D__ANDROID_API__=16 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-fp16 -Wno-unused-value “C:\Users\christophert\Desktop\Unity\Bayou\Temp\StagingArea\Il2Cpp\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp” -o “C:/Users/christophert/Desktop/Unity/Bayou/Library/il2cpp_android_armeabi-v7a/il2cpp_cache/libil2cpp/337971E1F1364159301BD222613D8D9C.o”

at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)

at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)

at il2cpp.Program.DoRun(String args)

at il2cpp.Program.Run(String args)

at il2cpp.Program.Main(String args)

stderr:

Unhandled Exception: Unity.IL2CPP.Building.BuilderFailedException: In file included from C:\Users\christophert\Desktop\Unity\Bayou\Temp\StagingArea\Il2Cpp\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp:72:

In file included from C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity\AtomicQueue.cpp:6:

In file included from C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps.h:121:

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:622:17: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:653:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:690:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:724:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:755:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r0”, “r1”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:793:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:833:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:875:27: error: asm-specifier for input or output variable conflicts with asm clobber list
: “cc”, “memory”, “r2”, “r3”
^

C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp\os\Unity/ExtendedAtomicOps-arm.h:917:27: error: asm-specifier for input or output variable conflicts with asm clobber list: “cc”, “memory”, “r2”, “r3”
^

9 errors generated.

Invocation was: Executable: “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK oolchains\llvm\prebuilt\windows-x86_64\bin\clang++”

Arguments: -DNET_4_0 -DUNITY_AOT -DGC_NOT_DLL -DRUNTIME_IL2CPP -DLINUX -DANDROID -DPLATFORM_ANDROID -D__linux__ -D__STDC_FORMAT_MACROS -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\bdwgc\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\libil2cpp\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\il2cpp\external\bdwgc\include" -I"." -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sources\cxx-stl\llvm-libc++\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sources\cxx-stl\llvm-libc++abi\include" -I"C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sources\android\support\include" -c -g -DNDEBUG -fexceptions -fno-limit-debug-info -fdata-sections -ffunction-sections -Wa,–noexecstack -fno-rtti -std=c++98 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-overflow -fPIC -Os --sysroot “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sysroot” -gcc-toolchain “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK oolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64” -target armv7-none-linux-androideabi -isystem “C:\Program Files\Unity\2019.1.9f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\sysroot\usr\include\arm-linux-androideabi” -D__ANDROID_API__=16 -march=armv7-a -mfloat-abi=softfp -mfpu=neon-fp16 -Wno-unused-value “C:\Users\christophert\Desktop\Unity\Bayou\Temp\StagingArea\Il2Cpp\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp” -o “C:/Users/christophert/Desktop/Unity/Bayou/Library/il2cpp_android_armeabi-v7a/il2cpp_cache/libil2cpp/337971E1F1364159301BD222613D8D9C.o”

at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)

at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)

at il2cpp.Program.DoRun(String args)

at il2cpp.Program.Run(String args)

at 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:128)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73) UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List1, Action1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:496) UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:477) UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334) UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

have some error.
resolving by back to 16 sdk & ndk

I had the same error,
unchecked the Strip Engine Code box and everything worked again

  • byte code stripping of managed assemblies is always enabled for the IL2CPP scripting backend.

try changing the player settings > Minimum API level to version 5.1 (API level 22) or higher

just rename your project folder if it have space or special characters remove it