I have searched using google, and through this forum’s search engine and I cannot find the solution to my problem.
I am trying to build using the recommended Android SDK modules (provided by Unity hub installer), and I have upgraded them to the latest versions.
As I am building, Unity throws these errors and the build fails:
Console error message:
Building Library\Bee\artifacts\Android\iz17e\libil2cpp.so failed with output:
C:/Program Files/Unity/Hub/Editor/2021.3.8f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/…/lib/gcc/arm-linux-androideabi/4.9.x/…/…/…/…/arm-linux-androideabi/bin\ld.gold.exe: fatal error: Library/Bee/artifacts/Android/iz17e/libil2cpp.so: File too large
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
UnityEditor.GenericMenu:CatchMenu (object,string[ ],int)
The culprit seems to be the libil2cpp.so which says “File too large”. I am using the default AR Core template, no changes made.
I have uninstalled the Android modules, reinstalled them and ensured windows 10 SDK and Visual Studio 2019 are all up to date. I’d appreciate any help I can get, as I’m supposed to use this for a school project and neither I or any of my peers/teachers can figure out what’s causing it.
Do you happen to have script debugging enabled? If so, you may want to disable that, as it will make the output executable much larger.
Another option is to use Unity 2022.2 instead. That version uses a newer Android NDK (r23) with the lld linker. That linker handles large files much better than the gold linker used in Unity 2021.
As far as I can tell, script debugging is disabled :
Apparently, I only have access to version 2021.3.8f1 through my student license. However, my 14 other classmates have not encountered this issue.
After sending them my project folder (still just the default AR Core template), they can build it just fine.
Is there an alternative to upgrading to 2022 here? Can I reinstall the il2cpp or a different version android kit somehow? Can I alter the maximum permissable filesize in some config? I’m running a medium/high end system with 32gb ram and loads of GB space for temporary file storage. My classmates running medium-spec laptops are not encountering this issue.
I assume reinstalling Unity won’t have an effect, as the linker is part of the Android SDK module?
You could also try changing the IL2CPP Code Generation option in the Build Settings to a value of “Faster (smaller) builds”. That will change the IL2CPP code generation to optimize for code size.
I don’t find it odd that this works for other though. The error message looks like it is a bug in the linker from the Android NDK. I’m unclear why the linker would fail for you but work for others with the same inputs.
Just tried to change for Faster (smaller) builds, and it’s throwing the same error as before. I’ve essentially sat side-by-side with a classmate who this works for, and compared settings across the board. I just can’t get it to build. It builds just fine in “mono” scripting backend, but not with the il2cpp option.
Before reinstalling the Android SDK modules, I tried copying the “Android Player” folder in PlaybackEngines from a classmate, but that didn’t work either.
I’ve spent the past 6 hours troubleshooting, trying a different version. Reinstalled Unity, all the modules. Yet I end up with the exact same problem.
Which dependencies do il2cpp rely on? Is there something I’m missing? I thought it would be an “out of the box” solution by simply adding them in the modules settings. Could there be firewall settings blocking il2cpp? I can’t for the life of me figure out what’s wrong.
Is there anything of value in the remaining error messages, or are these simply “nested” messages from the build process?
There must be something I can do to override the File size limit problem?
After all, it’s simply the AR Core template - basically the bare bones of an AR solution.
That seems like the right way to use the environment variable. Does the error message still indicate that the gold linker is used? This environment variable should change the behavior to use the lld linker.