Unity 5.5.0p4 il2cpp.exe did not run properly!

I am trying to build for android with il2cpp (mono works, ios il2cpp build works) but the build stops and i get this MessageBox:

but after i press ok i get the following errors:

ary\il2cpp_android_armeabi-v7a\il2cpp_cache
ObjectFiles: 583 of which compiled: 216
Time Compile: 201809 milliseconds Il2CppAttributes.cpp
Time Compile: 94540 milliseconds Bulk_Generics_29.cpp
Time Compile: 79323 milliseconds Il2CppInvokerTable.cpp
Time Compile: 63858 milliseconds Bulk_Generics_17.cpp
Time Compile: 50770 milliseconds Bulk_Generics_4.cpp
Time Compile: 49387 milliseconds Bulk_mscorlib_7.cpp
Time Compile: 44620 milliseconds Bulk_Generics_28.cpp
Time Compile: 41427 milliseconds Bulk_System_6.cpp
Time Compile: 40468 milliseconds Bulk_Generics_30.cpp
Time Compile: 39019 milliseconds Bulk_Generics_9.cpp
Total compilation time: 739248 milliseconds.
il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: E:\android-ndk-r10e\toolchains\llvm-3.6\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Paul\AppData\Local\Temp\tmp75E8.tmp” -o “E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_4018B83616D219CFD01A01CB86A79087\libil2cpp.so” -Wl,-soname,libil2cpp.so -shared -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id --sysroot “E:\android-ndk-r10e\platforms\android-9\arch-arm” -gcc-toolchain “E:\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64” -target armv7-none-linux-androideabi -L “E:\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a” -lgnustl_static -Xlinker -Map=“E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_4018B83616D219CFD01A01CB86A79087\libil2cpp.map” -fuse-ld=bfd

E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\714DEDC9861634F82D18B0197E02C872.o: In function Manager__validationTest_m1395585102': E:\My Town-Framework\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_22.cpp:30337: undefined reference to _validationTest’
E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\1287D577C23D141E77D599A5502F699F.o: In function DHGameManager__GetCommonContainerUrl_m2224876396': E:\My Town-Framework\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_1.cpp:4255: undefined reference to _GetCommonContainerUrl’
E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\FBCE0F365B5AE190289BCB363EFECBDA.o: In function IosNativePopups__showAlertView_m3424048941': E:\My Town-Framework\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_MobileNativePopups_0.cpp:685: undefined reference to _showAlertView’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(IEnumerable`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build()
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: E:\android-ndk-r10e\toolchains\llvm-3.6\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Paul\AppData\Local\Temp\tmp75E8.tmp” -o “E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_4018B83616D219CFD01A01CB86A79087\libil2cpp.so” -Wl,-soname,libil2cpp.so -shared -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id --sysroot “E:\android-ndk-r10e\platforms\android-9\arch-arm” -gcc-toolchain “E:\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64” -target armv7-none-linux-androideabi -L “E:\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a” -lgnustl_static -Xlinker -Map=“E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_4018B83616D219CFD01A01CB86A79087\libil2cpp.map” -fuse-ld=bfd

E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\714DEDC9861634F82D18B0197E02C872.o: In function Manager__validationTest_m1395585102': E:\My Town-Framework\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_22.cpp:30337: undefined reference to _validationTest’
E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\1287D577C23D141E77D599A5502F699F.o: In function DHGameManager__GetCommonContainerUrl_m2224876396': E:\My Town-Framework\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_1.cpp:4255: undefined reference to _GetCommonContainerUrl’
E:\My Town-Framework\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\FBCE0F365B5AE190289BCB363EFECBDA.o: In function IosNativePopups__showAlertView_m3424048941': E:\My Town-Framework\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_MobileNativePopups_0.cpp:685: undefined reference to _showAlertView’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(IEnumerable`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build()
at il2cpp.Program.DoRun(String[ ] args)
at il2cpp.Program.Run(String[ ] args)
at il2cpp.Program.Main(String[ ] args)

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:96) UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List1, Action1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:298) UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection1, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:289)
UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:131)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:32)
UnityEditor.HostView:OnGUI()

and

Exception: D:\Unity\Editor\Data\il2cpp/build/il2cpp.exe did not run properly!
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1 setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:98) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1 arguments, System.Action1 setupStartInfo, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:298) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (ICollection1 userAssemblies, System.String outputDirectory, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:289)
UnityEditorInternal.IL2CPPBuilder.Run () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:131)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action`1 modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry, Boolean developmentBuild) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:32)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:186)
UnityEditor.HostView:OnGUI()

I’m not sure about the cause of the initial SDK error. It may or may not be related to the next error you reported.

However, I can say that the error from the C++ compiler:

In function Manager__validationTest_m1395585102': E:\My Town-Framework\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_22.cpp:30337: undefined reference to _validationTest’

indicates that there is a method in C# code in the project named _validationTest which is an extern static method. This means its implementation is not in C#, but is in native code. IL2CPP requires that any methods implemented in native code be available for the current platform being built at link time. So I suspect a native library is missing for Android.

Hey, thanks for the answer, you where right we have forgotten to include the function import in the conditional compilation, the peoblem is fixed now :slight_smile:

Hi!

I’m just having this error, but just with the code from de asset (Mobile Native Popups) code.
How do you get rid of that error?

I’m using Unity 5.6.3p2. This is the main part of my stack trace:

il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Proyectos\android-ndk-r10e\toolchains\llvm-3.6\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Jose\AppData\Local\Temp\tmpE9A9.tmp” -o “C:\Proyectos\xxx\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_E0C24BE68314019BC4B4DAEB6D4A7D59\libil2cpp.so” -shared -Wl,-soname,libil2cpp.so -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id --sysroot “C:\Proyectos\android-ndk-r10e\platforms\android-16\arch-arm” -gcc-toolchain “C:\Proyectos\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64” -target armv7-none-linux-androideabi -Wl,–wrap,sigaction -L “C:\Proyectos\android-ndk-r10e\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi-v7a” -lgnustl_static -Xlinker -Map=“C:\Proyectos\xxx\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_E0C24BE68314019BC4B4DAEB6D4A7D59\libil2cpp.map” -fuse-ld=bfd

C:\Proyectos\xxx\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\B8DFC6C5FCEB533FA1CCAA09CBA28F6F.o: In function IosNativePopups__showAlertView_m3424048941': C:\Proyectos\xxx\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_MobileNativePopups_0.cpp:1233: undefined reference to _showAlertView’
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

en Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(IEnumerable`1 objectFiles, CppToolChainContext toolChainContext)
en Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
en Unity.IL2CPP.Building.Statistics.BuildingTestRunnerHelper.BuildAndLogStatsForTestRunner(CppProgramBuilder builder, IBuildStatistics& statistics)
en il2cpp.Program.DoRun(String[ ] args)
en il2cpp.Program.Run(String[ ] args)
en il2cpp.Program.Main(String[ ] args)

Thanks!

It looks like this is the issue:

C:\Proyectos\xxx\Temp\StagingArea\Il2Cpp\il2cppOutput/Bulk_MobileNativePopups_0.cpp:1233: undefined reference to `_showAlertView’

This error indicates that there is an extern method in C# named showAlertView, which has the [DllImport(“__Internal”)] attribute on it. When IL2CPP sees this, it requires the corresponding function in native code to exist for the target platform (Android, in this case). I suspect the Unity can’t find that function in a native library for Android.

Should that native function exist for Android? It might be the case that it exists only for another platform (maybe iOS). In that case, the C# code which defines that extern method should not be compiled for Android. You can use #if directives to make sure it is only compiled on the proper platform.

If this is in an assembly that you don’t compile, check with the vendor of that assembly. They might have an Android native library that you need.

Thanks Josh!

This assembly belongs to an store asset, so I’ve asked them for a solution.

The odd thing is that the build worked the first time, and then never again. I have this IL2CPP version working in my phone, and I have changed nothing in the project since this build.

Stranger things… :wink:

Also, I found a weird error building and, after too much time spent, I realized that the reason was the Android NDK has an acceted word in the path (librería). Just in case someone is falling in the same issue.

@jotmaz:
Did you manage to get it sorted with Mobile Native Popups? I’m having the same issue on Android IL2CPP…