endel / NativeWebSocket

🔌 WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP)
Other
1.28k stars 161 forks source link

Trying to build for WebGL fails #5

Closed Phantomb closed 4 years ago

Phantomb commented 4 years ago

I added these scripts to my Unity project, and changed the name of the WebSocket class to something else to avoid the same name as some other script I currently have.

Building for WebGL fails with the following message (see below) Could you maybe shed some light on what is missing or going wrong?

Failed running "C:/Program Files/Unity/Hub/Editor/2019.3.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "C:/Program Files/Unity/Hub/Editor/2019.3.1f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"C:\Users\heerpbuld\Documents\Code\Productive\unity\Unity4MCTS\Assets..\Temp\emcc_arguments.resp"

stdout: stderr:warning: unexpected number of arguments 1 in call to '__cxa_pure_virtual', should be 0warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 5 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 4 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 2 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0warning: unexpected number of arguments 3 in call to '_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv', should be 0error: unresolved symbol: Closeerror: unresolved symbol: Helloerror: unresolved symbol: InitWebSocketerror: unresolved symbol: Senderror: unresolved symbol: StateAborting compilation due to previous errors | undefinedTraceback (most recent call last): File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 3063, in sys.exit(run()) File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 1780, in run final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args) File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\shared.py", line 2274, in emscripten emscripten._main(cmdline) File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 2233, in _main return temp_files.run_and_clean(lambda: main( File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\tempfiles.py", line 93, in run_and_clean return func() File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 2238, in DEBUG=DEBUG, File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 2164, in main temp_files=temp_files, DEBUG=DEBUG) File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 86, in emscript glue, forwarded_data = compiler_glue(metadata, libraries, compiler_engine, temp_files, DEBUG) File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 218, in compiler_glue glue, forwarded_data = compile_settings(compiler_engine, libraries, temp_files) File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 541, in compile_settings cwd=path_from_root('src'), error_limit=300) File "C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\jsrun.py", line 132, in run_js raise Exception('Expected the command ' + str(command) + ' to finish with return code ' + str(assert_returncode) + ', but it returned with code ' + str(proc.returncode) + ' instead! Output: ' + str(ret)[:error_limit])Exception: Expected the command ['C:/Program Files/Unity/Hub/Editor/2019.3.1f1/Editor/Data\Tools\nodejs\node.exe', '--stack_size=8192', '--max-old-space-size=4096', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js', 'C:\Users\HEERPB~1\AppData\Local\Temp\tmpf_dgp6.txt', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Audio.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Cursor.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Eval.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\FileSystem.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Logging.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Profiler.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\SystemInfo.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\UnetWebSocket.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Video.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\WebCam.js', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\WebRequest.js', 'C:\Users\heerpbuld\Documents\Code\Productive\unity\Unity4MCTS\Assets\Imported Assets\WebSocket\WebSocket.jslib', 'C:\Program Files\Unity\Hub\Editor\2019.3.1f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\library_pthread_stub.js'] to finish with return code 0, but it returned with code 1 instead! Output: // The Module object: Our interface to the outside world. We import// and export values on it. There are various ways Module can be used:// 1. Not defined. We create it here// 2. A function parameter, function(Module) { ..generated code.. }// 3. pre-run appended it, var Module = {}; ..generated UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Phantomb commented 4 years ago

It turned out I had a script referencing my own, older version of the websocket.jslib. There were no compile errors shown in Visual Studio or Unity, but commenting out that entire script did enable me to build and avoid the error shown above, so I'm closing this.