当前位置:   article > 正文

Unity2020 il2cpp 代码多的情况下,直接打包出错,使用obb模式或导出到AndroidStudio工程再打apk没问题_unity android obb

unity android obb

在il2cpp打包android 的编译过程报错,因为项目中用的puerts框架,需要生成很多wrap类。如果打包时勾选Split Application Binary 也用obb分包情况下,使用unity可以直接导出到apk和obb。但如果不勾选,编译会报错。
同样不勾选Split Application Binary 在Build时,Export Project 导出到AndroidStudio工程再生成apk也不会有问题。请问有老哥遇到过这样的问题吗。Unity版本2020.2.3
Exception: Unity.IL2CPP.Building.BuilderFailedException: D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++ @“C:\Users\Administrator\AppData\Local\Temp\tmp30FE.tmp” -o “D:\workroot\Crusher\Crusher\Library\il2cpp_android_arm64-v8a\il2cpp_cache\linkresult_B322E1396ADEEC5519CBECC8D02E669C\libil2cpp.so” -shared -Wl,-soname,libil2cpp.so -Wl,–no-undefined -Wl,-z,noexecstack -Wl,–gc-sections -Wl,–build-id -stdlib=libc++ -static-libstdc++ -target aarch64-linux-android21 -Wl,–wrap,sigaction “D:\Softwares\Unity2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Development\StaticLibs\arm64-v8a\baselib.a” -llog -rdynamic -fuse-ld=bfd.exe

D:\Softwares\Unity2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Development\StaticLibs\arm64-v8a\baselib.a(External_il2cpp_builds_external_baselib_Platforms_Android_Source_0.o): In function LinuxApi::detail::futex(int*, int, int, timespec const*, int*, int)': /Users/bokken/buildslave/unity/build/External/il2cpp/builds/external/baselib/Source/Linux/Baselib_SystemFutex_LinuxApi.inl.h:20:(.text._ZN14il2cpp_baselib24Baselib_SystemFutex_WaitEPiij+0x48): relocation truncated to fit: R_AARCH64_CALL26 against symbolsyscall@@LIBC’ defined in .text section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
/Users/bokken/buildslave/unity/build/External/il2cpp/builds/external/baselib/Source/Linux/Baselib_SystemFutex_LinuxApi.inl.h:20:(.text._ZN14il2cpp_baselib26Baselib_SystemFutex_NotifyEPijNS_30Baselib_WakeupFallbackStrategyE+0x28): relocation truncated to fit: R_AARCH64_JUMP26 against symbol syscall@@LIBC' defined in .text section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/../sysroot/usr/lib/aarch64-linux-android/21/libc.so D:\Softwares\Unity2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Development\StaticLibs\arm64-v8a\baselib.a(External_il2cpp_builds_external_baselib_Platforms_Android_Source_0.o): In functionPosixApi::Baselib_Thread_GetCurrentThreadId()’:
/Users/bokken/buildslave/unity/build/External/il2cpp/builds/external/baselib/Source/Posix/Baselib_Thread_PosixApi.inl.h:150:(.text._ZN14il2cpp_baselib33Baselib_Thread_GetCurrentThreadIdEv+0x0): relocation truncated to fit: R_AARCH64_JUMP26 against symbol pthread_self@@LIBC' defined in .text section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/../sysroot/usr/lib/aarch64-linux-android/21/libc.so D:\Softwares\Unity2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Development\StaticLibs\arm64-v8a\baselib.a(External_il2cpp_builds_external_baselib_Platforms_Android_Source_0.o): In functiondetail::GetTimeAsSeconds(int)’:
/Users/bokken/buildslave/unity/build/./External/il2cpp/builds/external/baselib/Platforms/Android/Source/Baselib_Timer_Android.cpp:11:(.text._ZN14il2cpp_baselib42Baselib_Timer_GetTimeSinceStartupInSecondsEv+0x24): relocation truncated to fit: R_AARCH64_CALL26 against symbol clock_gettime@@LIBC' defined in .text section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/../sysroot/usr/lib/aarch64-linux-android/21/libc.so /Users/bokken/buildslave/unity/build/./External/il2cpp/builds/external/baselib/Platforms/Android/Source/Baselib_Timer_Android.cpp:11:(.text._ZN14il2cpp_baselib42Baselib_Timer_GetTimeSinceStartupInSecondsEv+0x4c): relocation truncated to fit: R_AARCH64_CALL26 against symbolclock_gettime@@LIBC’ defined in .text section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/sysroot/usr/lib/aarch64-linux-android/21/libc.so
D:\Softwares\Unity2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Development\StaticLibs\arm64-v8a\baselib.a(External_il2cpp_builds_external_baselib_Platforms_Android_Source_0.o): In function platform::Baselib_Timer_GetTimeSinceStartupInSeconds()': /Users/bokken/buildslave/unity/build/./External/il2cpp/builds/external/baselib/Platforms/Android/Source/Baselib_Timer_Android.cpp:43:(.text._ZN14il2cpp_baselib42Baselib_Timer_GetTimeSinceStartupInSecondsEv+0x1cc): relocation truncated to fit: R_AARCH64_CALL26 against symbol__cxa_guard_acquire’ defined in .text.__cxa_guard_acquire section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/sysroot/usr/lib/aarch64-linux-android\libcabi.a(cxa_guard.o)
/Users/bokken/buildslave/unity/build/./External/il2cpp/builds/external/baselib/Platforms/Android/Source/Baselib_Timer_Android.cpp:43:(.text._ZN14il2cpp_baselib42Baselib_Timer_GetTimeSinceStartupInSecondsEv+0x218): relocation truncated to fit: R_AARCH64_CALL26 against symbol __cxa_guard_release' defined in .text.__cxa_guard_release section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/../sysroot/usr/lib/aarch64-linux-android\libc++abi.a(cxa_guard.o) D:\Softwares\Unity2020.2.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp\Development\StaticLibs\arm64-v8a\baselib.a(External_il2cpp_builds_external_baselib_Platforms_Android_Source_0.o): In function~basic_ostream’:
/Users/bokken/buildslave/unity/build/External/Android/NonRedistributable/ndk/builds/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c/v1/ostream:311:(.text._ZNSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED1Ev[_ZNSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED1Ev]+0x4): relocation truncated to fit: R_AARCH64_JUMP26 against symbol std::__ndk1::ios_base::~ios_base()' defined in .text._ZNSt6__ndk18ios_baseD2Ev section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/../sysroot/usr/lib/aarch64-linux-android\libc++_static.a(ios.o) /Users/bokken/buildslave/unity/build/External/Android/NonRedistributable/ndk/builds/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/ostream:311:(.text._ZNSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED0Ev[_ZNSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED0Ev]+0xc): relocation truncated to fit: R_AARCH64_CALL26 against symbolstd::__ndk1::ios_base::~ios_base()’ defined in .text._ZNSt6__ndk18ios_baseD2Ev section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/sysroot/usr/lib/aarch64-linux-android\libc++_static.a(ios.o)
/Users/bokken/buildslave/unity/build/External/Android/NonRedistributable/ndk/builds/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/ostream:311:(.text._ZNSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED0Ev[_ZNSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED0Ev]+0x18): relocation truncated to fit: R_AARCH64_JUMP26 against symbol `operator delete(void*)’ defined in .text._ZdlPv section in D:\DevEnvironment\android-ndk-r19\toolchains\llvm\prebuilt\windows-x86_64\bin/…/sysroot/usr/lib/aarch64-linux-android\libc++_static.a(new.o)
/Users/bokken/buildslave/unity/build/External/Android/NonRedistributable/ndk/builds/toolchains/llvm/prebuilt/darwin-x86_64/bin/…/sysroot/usr/include/c++/v1/ostream:311:(.text._ZTv0_n24_NSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED1Ev[_ZTv0_n24_NSt6__ndk113basic_ostreamIcNS_11char_traitsIcEEED1Ev]+0x10): additional relocation overflows omitted from the output
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection1 matchedAssemblyMethodSourceFiles)
at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
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.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <a936841cea2147a2a55ea27843fa46ae>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo, System.String generatedCppOutputDirectory) (at <a936841cea2147a2a55ea27843fa46ae>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.Boolean platformSupportsManagedDebugging) (at <a936841cea2147a2a55ea27843fa46ae>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <a936841cea2147a2a55ea27843fa46ae>: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 :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 :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Unity编译IL2CPP

赞同 0评论 分享

5条回复

廖武兴回答于 10 个月前

已解决


尝试增加jvm的内存,或者指定一个ndk版本

赞同 2评论 1 分享

  • B

    Bomber

    我试一下~多谢老哥~

    9 个月前

评论

T

thrt520回答于 2 年前

additional relocation overflows omitted from the output
注意这个,可能是静态数组太大了,编译器的内存模型不够 可以自己添加IL2CPP的编译选项(我也没试过 逃~

赞同 0评论 分享

J

jack回答于 10 个月前

楼主解决了嘛?2020.3 也遇到这个问题

赞同 0评论 分享

萧小俊回答于 10 个月前

看上去是NDK那边失败了,可以尝试一下以下做法。
尝试一下不要勾选Development Build,可能是生成的二进制文件太大,导致的奔溃。

赞同 0评论 分享

B

Bomber回答于 9 个月前

亲测 Maximun JVM heap size,MBytes 增加JVM内存有效

赞同 0

原文:Unity2020 il2cpp 代码多的情况下,直接打包出错,使用obb模式或导出到AndroidStudio工程再打apk没问题 -- UWA问答 | 游戏开发者互动问答社区 | 侑虎科技

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/336550
推荐阅读
相关标签
  

闽ICP备14008679号