il2cpp.exe did not run properly!

I have problem with il2cpp, i have alredy read other posts but nothing help to me.

Exception: C:\Program Files\Unity\Hub\Editor\2020.1.17f1\Editor\Data\il2cpp/build/deploy/netcoreapp3.0/il2cpp.exe did not run properly!

Failed running “C:\Program Files\Unity\Hub\Editor\2020.1.17f1\Editor\Data\il2cpp/build/deploy/netcoreapp3.0/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\Vital\Documents\Workflow\Client2\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so” --cachedirectory=“C:\Users\Vital\Documents\Workflow\Client2\Assets..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache” --additional-include-directories=“C:/Program Files/Unity/Hub/Editor/2020.1.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\bdwgc/include” --additional-include-directories=“C:/Program Files/Unity/Hub/Editor/2020.1.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\libil2cpp/include” --baselib-directory=“C:/Program Files/Unity/Hub/Editor/2020.1.17f1/Editor/Data/PlaybackEngines/AndroidPlayer\Variations\il2cpp\Release\StaticLibs\armeabi-v7a” --avoid-dynamic-library-copy --tool-chain-path=“C:/Program Files/Unity/Hub/Editor/2020.1.17f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK” --incremental-g-c-time-slice=3 --profiler-report --map-file-parser=“C:/Program Files/Unity/Hub/Editor/2020.1.17f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe” --directory=C:/Users/Vital/Documents/Workflow/Client2/Temp/StagingArea/assets/bin/Data/Managed --generatedcppdir=C:/Users/Vital/Documents/Workflow/Client2/Temp/StagingArea/Il2Cpp/il2cppOutput

stdout:
Running il2cpp.exe in server GC mode.
Building libil2cpp.so with AndroidToolChain
Output directory: C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a
Cache directory: C:\Users\Vital\Documents\Workflow\Client2\Library\il2cpp_android_armeabi-v7a\il2cpp_cache
ObjectFiles: 262 of which compiled: 0
Total compilation time: 343 milliseconds.
il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2020.1.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Vital\AppData\Local\Temp\tmp3168.tmp” -o “C:\Users\Vital\Documents\Workflow\Client2\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_79BF8B231B2A70FA221E47CB3B313A44\libil2cpp.so” -shared -Wl,-soname,libil2cpp.so -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id -stdlib=libc++ -static-libstdc++ -target armv7-linux-androideabi19 -Wl,–wrap,sigaction “C:\Program Files\Unity\Hub\Editor\2020.1.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Release\StaticLibs\armeabi-v7a\baselib.a” -llog -rdynamic -fuse-ld=gold.exe

C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38251: error: undefined reference to ‘LsNdShowCenter’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38251: error: undefined reference to ‘LsNdShowCenter’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38134: error: undefined reference to ‘LsGetBundleVersion’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38152: error: undefined reference to ‘LsGetBundleIdentifier’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38174: error: undefined reference to ‘LsSetUnityReceiver’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38187: error: undefined reference to ‘LsNdInit’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38196: error: undefined reference to ‘LsNdLogin’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38205: error: undefined reference to ‘LsNdLoginEx’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38214: error: undefined reference to ‘LsNdShowToolBar’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38223: error: undefined reference to ‘LsNdHideToolBar’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38232: error: undefined reference to ‘LsisLogined’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38242: error: undefined reference to ‘LsNdPause’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38260: error: undefined reference to ‘LsgetCurrentLoginState’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38270: error: undefined reference to ‘LsloginUin’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38288: error: undefined reference to ‘LssessionId’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38306: error: undefined reference to ‘LsnickName’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38324: error: undefined reference to ‘LsNdLogout’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38350: error: undefined reference to ‘LSNdUniPay’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38392: error: undefined reference to ‘LsNdUniPayAsyn’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38426: error: undefined reference to ‘LsNdUniPayForCoin’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions)
at il2cpp.Program.DoRun(String[ ] args, RuntimePlatform platform, BuildingOptions buildingOptions)
at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[ ] args)
stderr:
Unhandled exception. Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2020.1.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Vital\AppData\Local\Temp\tmp3168.tmp” -o “C:\Users\Vital\Documents\Workflow\Client2\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_79BF8B231B2A70FA221E47CB3B313A44\libil2cpp.so” -shared -Wl,-soname,libil2cpp.so -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id -stdlib=libc++ -static-libstdc++ -target armv7-linux-androideabi19 -Wl,–wrap,sigaction “C:\Program Files\Unity\Hub\Editor\2020.1.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Release\StaticLibs\armeabi-v7a\baselib.a” -llog -rdynamic -fuse-ld=gold.exe

C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38251: error: undefined reference to ‘LsNdShowCenter’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38251: error: undefined reference to ‘LsNdShowCenter’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38134: error: undefined reference to ‘LsGetBundleVersion’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38152: error: undefined reference to ‘LsGetBundleIdentifier’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38174: error: undefined reference to ‘LsSetUnityReceiver’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38187: error: undefined reference to ‘LsNdInit’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38196: error: undefined reference to ‘LsNdLogin’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38205: error: undefined reference to ‘LsNdLoginEx’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38214: error: undefined reference to ‘LsNdShowToolBar’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38223: error: undefined reference to ‘LsNdHideToolBar’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38232: error: undefined reference to ‘LsisLogined’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38242: error: undefined reference to ‘LsNdPause’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38260: error: undefined reference to ‘LsgetCurrentLoginState’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38270: error: undefined reference to ‘LsloginUin’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38288: error: undefined reference to ‘LssessionId’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38306: error: undefined reference to ‘LsnickName’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38324: error: undefined reference to ‘LsNdLogout’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38350: error: undefined reference to ‘LSNdUniPay’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38392: error: undefined reference to ‘LsNdUniPayAsyn’
C:\Users\Vital\Documents\Workflow\Client2\Temp\StagingArea\Il2Cpp\il2cppOutput/Assembly-CSharp17.cpp:38426: error: undefined reference to ‘LsNdUniPayForCoin’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions)
at il2cpp.Program.DoRun(String[ ] args, RuntimePlatform platform, BuildingOptions buildingOptions)
at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[ ] args)

UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at :0)
UnityEditorInternal.Runner.RunNetCoreProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <c84609c921cb488481d7d8a5fcdf9588>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo, System.String workingDirectory) (at <c84609c921cb488481d7d8a5fcdf9588>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at <c84609c921cb488481d7d8a5fcdf9588>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <c84609c921cb488481d7d8a5fcdf9588>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at :0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <3746c56c485a40cda2a56050de658f5e>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <3746c56c485a40cda2a56050de658f5e>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <3746c56c485a40cda2a56050de658f5e>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <3746c56c485a40cda2a56050de658f5e>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

1 Like

Same issue on Standalone build

1 Like

The same problem. I can’t build my project.

Search for ‘error: undefined reference to’ in the log, it mentions native function names which are missing. Either provide the implementation for those functions (like a native library) or ifdef out the caller code, for ex.

#if !UNITY_ANDROID
...
#endif

The problem is in the test.cs script. I don’t know how to resolve this. There were no problems in the 2019 version.

6620761–754363–test.cs (429 KB)

I think you’re having different error, looking at the file, it’s possible you’re hitting a limit for how big one compilation unit can be. Try splitting those function into different classes & files instead. Also please share the Editor.log, so it would be possible what exactly is the error.

You’re right. Now I’m having another error:

Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\XXX\Library\Il2cppBuildCache\Android\armeabi-v7a\il2cppOutput\Assembly-CSharp.cpp:4339:4610: fatal error: bracket nesting level exceeded maximum of 256
C:\XXX\Library\Il2cppBuildCache\Android\armeabi-v7a\il2cppOutput\Assembly-CSharp.cpp:4339:4610: note: use -fbracket-depth=N to increase maximum nesting level
1 error generated.

Maybe you know where and how can I use the option -fbracket-depth=N?

Such ability is not exposed as far as I know, you cannot pass custom options to native compiler.