-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unity 2019.1 TriLib WebGL build failed #8131
Comments
From the error, I'd guess that zlib is being linked in twice - maybe both Unity and TriLib contain it? |
Thank you respond. Failed running "C:\Program Files\Unity\Hub\Editor\2019.1.0b3\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "C:\Program Files\Unity\Hub\Editor\2019.1.0b3\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc" @"D:\UnityProjects\ub_unity2019\ub_unity\Assets..\Temp\emcc_arguments.resp" stdout: |
Perhaps one of the two projects has a partial build of zlib? That would explain both problems. |
Hi! I'm the developer of TriLib and came accross this today. And indeed, that's the reason of many TriLib WebGL issues where facing. I couldn't find any way to hide the internal ZLIB (among other libraries) symbols of Assimp (used internally by TriLib) from outter code yet. We are working to fix these issues, but any tip is appreciated. Best regards, |
Hi everyone, I managed to compile removing the duplicated emscripten folders under Plugin/WebGL (I left only Emscripten1.38.11). I also removed the Android, iOS, Linux, OSX, UWP folders. I'm using the class AssetLoader (not async because as far as I know Threads are not yet supported in webgl).
When I run the WebGL compiled application the assetLoader.LoadFromMemory function calls InternalLoadFromMemory that calls ImportFileFromMemory that calls AssimpInterop.ai_ImportFileFromMemory that calls _aiImportFileFromMemory. My first guess is that the following instruction: EntryPoint = "aiImportFileFromMemory" at line 112 in AssimpInterop.cs
is not recognized properly. Modifying the name of the external funtion to aiImportFileFromMemory (without the underscore) and removing the EntryPoint property I get another error in webgl build saying "missing function: aiImportFileFromMemory". At this point my next guess is that i left the wrong Emscripten folder. I'm using Unity 2018.3.10f1, which Emscripten folder am I supposed to use? Thanks |
cc @juj |
@kevor you don't need to change the methods declarations on the .cs files. The latest TriLib version has four WebGL libraries variations: The reason for four different libraries is because the different Emscripten versions used by Unity won't recognize a library built with earlier Emscripten tools. I would suggest you to try another Unity version on this list to check if that's an issue with your specific Unity version.. |
@kripken I've generated an output file with "llvm-nm" from the library I'm building (libassimp.so <-dynamic) where we can see the issue better: |
You can make them local by renaming them, and using the new name in the places calling them. Another option is to mark them as |
Does that mean there is a solution on Unity2019.1 on WebGL? I downloaded the latest version 1.8.9a of Trilib on assetstore and found it wouldn't work still |
@kripken I was able to fix the issues by replacing the C files functions and const names with batch scripts, but the Emscripten tools 1.37.3 can't find some stdlib symbols like this one: |
It's very likely 1.38.11 and 1.37.3 have incompatible bitcode, yes, those are over a year apart, and we upgraded LLVM in between. I'm not aware of any open bugs on missing stdlib symbols. But if you can get a testcase I can take a look at that - the bitcode to compile + the command to see the error with that bitcode should be enough. |
@kripken I can give you access to my project GitHub repo. Testing is pretty simple, using LLVM-NM will show the U (Undefined) stdlib symbols on the generated library. Edit: What OS do you use for testing? |
@rickomax sure, any way I can access the bitcode file to test is good. I'm on linux. |
@kripken I've invited you to the private repository. The usage is described in the README, it should be simple to follow. Thank you! |
@rickomax I followed the instructions there but it hits a build error. I opened an issue on the repo so the info is private. However, I didn't realize this depends on 1.37.3. That's over a year old, and it's very possible you are seeing a bug that has been fixed, so updating may resolve things. |
Sorry @kripken ! |
Ok, it builds If that was expected, then next it prints some undefined symbols on the .so file. It's expected that those should be undefined - this is before linking in system libraries. So that looks ok as well. |
@kripken exactly, the library compiles just fine. When linking this library with the Emscripten project Unity outputs, it will complain about these undefined symbols and won't finish the compilation. So as far as I understood, the Emscripten version used in Unity is missing them, right? It's odd because when I link the library with Unity versions prior to Emscripten 1.38.11, it will link the library just fine, the error occurs on Emscripten version 1.38.11 onwards. It will complain specifically about these std::__2::basic_string symbols and some others on the std namespace. Maybe Unity Clang version is stripped-out or these symbols aren't available on newer Clang libraries. |
Hmm, I'm not sure what's wrong, but it's impossible to tell without looking at the emscripten build inside unity. Testing with 1.37.3 in your testcase, If you have a ticket open with unity, feel free to cc me into any conversation there, happy to help there if I can. |
@kripen I'm trying to simulate the Unity environment on my repo. Meanwhile, I was able to capture the full output log and the arguments passed to EMCC: EMCC arguments (Emscripten 1.38.11):
Output:
|
Have you filed a ticket with them? This sounds like a bug they would want to know about. Or perhaps there is a reason for the change that isn't obvious to us. cc @juj |
As far as I know, UnityNative.js is included with all the ".jspre" files. Maybe you can add your own ".jspre" file and include those missing declarations there. |
@De-Panther I'm not sure how I could add only some symbols from a library into a .jspre. I will take a look and check if it's possible. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
Hello,
in Unity 2019.1 and TriLib (assimp for unity)
when build WebGL, there is a error message and failed to build.
Failed running "...\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "...\WebGLSupport\BuildTools\Emscripten\emcc" @"...\Assets..\Temp\emcc_arguments.resp"
stdout:
stderr:error: Linking globals named 'gzgetc': symbol multiply defined!ERROR:root:Failed to run llvm optimizations:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Do you guys have any idea?
Thank you
The text was updated successfully, but these errors were encountered: