Skip to content
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

WebGL build error (unity2021.3.6) #17610

Open
z79422957 opened this issue Aug 9, 2022 · 3 comments
Open

WebGL build error (unity2021.3.6) #17610

z79422957 opened this issue Aug 9, 2022 · 3 comments

Comments

@z79422957
Copy link

Hi,
I used websoket.I can't build a webgl program in unity2021.3.6, it reports an error. There is no such error in unity2020.

Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
error: undefined symbol: sendfile (referenced by top-level compiled C/C++ code)
warning: Link with -s LLD_REPORT_UNDEFINED to get more information on undefined symbols
warning: To disable errors for undefined symbols use -s ERROR_ON_UNDEFINED_SYMBOLS=0
warning: _sendfile may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library

https://forum.unity.com/threads/webgl-build-error-unity2021-3-6.1320369/

@sidorovkirill
Copy link

sidorovkirill commented Sep 2, 2022

Hi @z79422957. I also faced this issue in unity 2021.3.8. Did you resolve it?

@sbc100
Copy link
Collaborator

sbc100 commented Sep 6, 2022

Emscripten doesn't support sendfile and I don't think we ever even had a stub for it. There used to be a header which was removed in #14248.

Can you try adding -Wl,--trace-symbol=sendfile to your link command?

@juj maybe be able to help on the unity side.

@juj
Copy link
Collaborator

juj commented Sep 8, 2022

@sidorovkirill @z79422957 are you saying that the same Unity project used to build successfully over to WebGL with Unity 2020.something.something, but after updating to Unity 2021.3.8, it no longer does, but gives the error about the sendfile function?

If that is the case, then this does sound like a potential Unity regression - feel free to report it if you have a small uploadable repro.

The function sendfile indeed should not exist in Emscripten or in Unity, and Unity code should not be depending on it, which makes me curious where that could come from.

If you want to test the issue out yourself, you could create a Unity editor script under <YourUnityProject>/Assets/Editor/MyWebGLEditorScript.cs, with the contents

using UnityEditor;

public class Foo
{
    Foo()
    {
        PlayerSettings.WebGL.emscriptenArgs = "-Wl,--trace-symbol=sendfile";
    }
}

That will issue an extra linker directive to Emscripten at WebGL build link time. You'll likely need to read the results out of the log file C:\Users<username>\AppData\Local\Unity\Editor\Editor.log

When I run that locally on an empty Unity project, I don't find any logs being printed, which means that LLVM linker thinks that function is not present or referenced (like it shouldn't be).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants