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

Generate side modules when destination is .so and SIDE_MODULE=1 ? #9770

Beuc opened this issue Nov 3, 2019 · 2 comments


Copy link

@Beuc Beuc commented Nov 3, 2019


I see that emcc issues a fatal warning and instructs 2-step recompilation in this situation:

$ emcc -s SIDE_MODULE=1 module.o
shared:ERROR: SIDE_MODULE must only be used when compiling to an executable shared library, and not when emitting an object file.  That is, you should be emitting a .wasm file (for wasm) or a .js file (for asm.js). Note that when compiling to a typical native suffix for a shared library (.so, .dylib, .dll; which many build systems do) then Emscripten emits an object file, which you should then compile to .wasm or .js with SIDE_MODULE.

which means one has to:

# don't pass -s SIDE_MODULE=1 to the build system
$ mv module.bc
$ emcc -s SIDE_MODULE=1 module.bc module.wasm
$ mv module.wasm

I was wondering if in this case it'd make sense to directly build a wasm side module, even if the extension is not '.wasm' (which I would rename to .so anyway e.g. to stay compatible with the ported tool's naming conventions and/or benefit from --use-preload-plugins).

From the build system PoV, one would only need to add


This comment has been minimized.

Copy link

@sbc100 sbc100 commented Nov 3, 2019


This comment has been minimized.

Copy link

@kripken kripken commented Nov 4, 2019

Agreed with all the above.

I think this would be a safe change given all that, as if someone explicitly passes in SIDE_MODULE then that is what they want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.