You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the same missing function error in the browser console.
The missing function is defined in src/library_websocket.js so my guess is that this file is not included in the generated js file.
Well it turns out that I was under the (wrong?) assumption that emscripten would automatically lookup used symbols and include the corresponding .js files from src/
If I compile like
The functions definitions are included and the sample works in the browser. This solves my issue but leaves the question, whether there is a way to let emcc do the work of finding and including neccessary .js files located under src/?
Traditionally we would link all JS libraries under src/ to the build, but as that set of code grew, it was becoming a bit silly - not all developers should link to everything (slows down builds and accidental symbol clashes become more probable).
Websocket support is brand new, so there the old autolinking scheme is not followed, try passing -lwebsocket.js to the build. (the --js-library option also works, but is a bit more verbose). Doc entry for this is landing, though the PR is still under review.
Problem description
I want to use the WebSockets api introduced in #7670. There is a test file for the api
in tests/websocket/websocket.c
The file is compiled using
Running the resulting a.out.js with node gives the following output:
If the file is compiled for web with
and served with
I get the same missing function error in the browser console.
The missing function is defined in src/library_websocket.js so my guess is that this file is not included in the generated js file.
Environment Info:
OS: archlinux
emcc --version: emcc (Emscripten gcc/clang-like replacement) 1.38.25 ((unknown revision))
node --version: v11.9.0
chromium --version: Chromium 71.0.3578.98 Arch Linux
The text was updated successfully, but these errors were encountered: