Unity第一次导出IL2CPP的Android工程 Target Architectures 选择ARMv7 然后Export ,导出失败,报错日志:
Exception: K:\DevTools\Unity\Unity2019.4.34f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe did not run properly!
Failed running “K:\DevTools\Unity\Unity2019.4.34f1\Editor\Data\il2cpp/build/deploy/net471/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=“J:\XXX\Client\Project\Branch\712Android\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so” --cachedirectory=“J:\XXX\Client\Project\Branch\712Android\Assets…\Library\il2cpp_android_armeabi-v7a/il2cpp_cache” --additional-include-directories=“K:/DevTools/Unity/Unity2019.4.34f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\bdwgc/include” --additional-include-directories=“K:/DevTools/Unity/Unity2019.4.34f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\libil2cpp/include” --tool-chain-path=“K:/Android/NDK/android-ndk-r19” --profiler-report --map-file-parser=K:/DevTools/Unity/Unity2019.4.34f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe --directory=J:/XXX/Client/Project/Branch/712Android/Temp/StagingArea/assets/bin/Data/Managed --generatedcppdir=J:/XXX/Client/Project/Branch/712Android/Temp/StagingArea/Il2Cpp/il2cppOutput
stdout:
Building libil2cpp.so with AndroidToolChain
Output directory: J:\XXX\Client\Project\Branch\712Android\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a
Cache directory: J:\XXX\Client\Project\Branch\712Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache
ObjectFiles: 404 of which compiled: 0
Total compilation time: 322 milliseconds.
il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: K:\Android\NDK\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\admin\AppData\Local\Temp\tmp3D15.tmp” -o “J:\XXX\Client\Project\Branch\712Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_0275BDD0908C11B5BC6CDA35BD17F423\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 -llog -rdynamic -fuse-ld=gold.exe
K:\Android\NDK\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/lib/gcc/arm-linux-androideabi/4.9.x/…/…/…/…/arm-linux-androideabi/bin\ld.gold.exe: error: J:/XXX/Client/Project/Branch/712Android/Library/il2cpp_android_armeabi-v7a/il2cpp_cache/775C3B658E5AF60641DF53B8CD7A385E.o: section name section has wrong type: 2621440
K:\Android\NDK\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/lib/gcc/arm-linux-androideabi/4.9.x/…/…/…/…/arm-linux-androideabi/bin\ld.gold.exe: fatal error: J:/XXX/Client/Project/Branch/712Android/Library/il2cpp_android_armeabi-v7a/il2cpp_cache/775C3B658E5AF60641DF53B8CD7A385E.o: attempt to map 3850375212 bytes at offset 3778019102 exceeds size of file; the file may be corrupt
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
�� Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) �� Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) �� il2cpp.Program.DoRun(String[] args, List
1 foundAssemblies)
�� il2cpp.Program.Run(String[] args, Boolean setInvariantCulture)
�� il2cpp.Program.Main(String[] args)
stderr:
δ��������쳣: Unity.IL2CPP.Building.BuilderFailedException: K:\Android\NDK\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\admin\AppData\Local\Temp\tmp3D15.tmp” -o “J:\XXX\Client\Project\Branch\712Android\Library\il2cpp_android_armeabi-v7a\il2cpp_cache\linkresult_0275BDD0908C11B5BC6CDA35BD17F423\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 -llog -rdynamic -fuse-ld=gold.exe
K:\Android\NDK\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/lib/gcc/arm-linux-androideabi/4.9.x/…/…/…/…/arm-linux-androideabi/bin\ld.gold.exe: error: J:/XXX/Client/Project/Branch/712Android/Library/il2cpp_android_armeabi-v7a/il2cpp_cache/775C3B658E5AF60641DF53B8CD7A385E.o: section name section has wrong type: 2621440
K:\Android\NDK\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/lib/gcc/arm-linux-androideabi/4.9.x/…/…/…/…/arm-linux-androideabi/bin\ld.gold.exe: fatal error: J:/XXX/Client/Project/Branch/712Android/Library/il2cpp_android_armeabi-v7a/il2cpp_cache/775C3B658E5AF60641DF53B8CD7A385E.o: attempt to map 3850375212 bytes at offset 3778019102 exceeds size of file; the file may be corrupt
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
�� Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) �� Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) �� il2cpp.Program.DoRun(String[] args, List
1 foundAssemblies)
�� il2cpp.Program.Run(String[] args, Boolean setInvariantCulture)
�� 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 <785fa035f6c842aea795e821898770c6>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <785fa035f6c842aea795e821898770c6>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List
1[T] arguments, System.Action1[T] setupStartInfo, System.String workingDirectory) (at <785fa035f6c842aea795e821898770c6>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at <785fa035f6c842aea795e821898770c6>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <785fa035f6c842aea795e821898770c6>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action
1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <785fa035f6c842aea795e821898770c6>:0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :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 :0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at :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 <785fa035f6c842aea795e821898770c6>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
最终解决办法:将Library/il2cpp_android_armeabi-v7a文件夹中的文件删除,重新导出,成功。