-
Notifications
You must be signed in to change notification settings - Fork 3.4k
SHARED / dynamic library with CMake #15276
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
Comments
the error I see when I compile everything as static as possible is:
|
besides this issue cling builds like a charm. |
You can build with something like For a working example of passing such flags, binaryen's CMakeLists.txt might be helpful. Here is a flag: And here is the helper function: |
thank you very much, it seems to work indeed when I pass the flags as shown above. |
I'm pretty sure you can configure llvm to avoid depending on dlopen. It doesn't seem like it should be an essentail part of clang or llvm. You should be able build a fully statistically linked version. |
@sbc100 It would be awesome to get ride of the dlopen. If you have any hints, I would be super thankfull. |
One thing you can try is adding Another approach would be to remove these stub functions: emscripten/src/library_dylink.js Lines 185 to 193 in ff23b8c
That way you will get a link error instead of a compile error when attempting to include dlopen. |
Only if ALLOW_UNIMPLEMENTED_SYSCALLS (which is also set by STRICT) is used. This was previously only ever a runtime error. Should help with #15276 (comment)
will give this a try as soon as I can, thanks for the hints! very much appreciated! |
Only if ALLOW_UNIMPLEMENTED_SYSCALLS (which is also set by STRICT) is used. This was previously only ever a runtime error. Should help with #15276 (comment)
I am running into the same problem with Pyodide trying to build geos. We really do want to dynamically link geos, static linking is not an option. How do we get CMake to work? Should I open a separate issue? |
I tried adding |
Only if ALLOW_UNIMPLEMENTED_SYSCALLS (which is also set by STRICT) is used. This was previously only ever a runtime error. Should help with #15276 (comment)
I think I found a way how we can overwrite this manually: # CLI
... -DCMAKE_PROJECT_INCLUDE=overwriteProp.cmake # overwriteProp.cmake
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-s SIDE_MODULE=1")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1")
set(CMAKE_STRIP FALSE) # used by default in pybind11 on .so modules Used in: pyodide/pyodide#2169 |
Only if ALLOW_UNIMPLEMENTED_SYSCALLS (which is also set by STRICT) is used. This was previously only ever a runtime error. Should help with #15276 (comment)
Only if ALLOW_UNIMPLEMENTED_SYSCALLS (which is also set by STRICT) is used. This was previously only ever a runtime error. Should help with #15276 (comment)
…15293) Only if ALLOW_UNIMPLEMENTED_SYSCALLS (which is also set by STRICT) is used. This was previously only ever a runtime error. Should help with #15276 (comment)
Emscripten shared library fix: emscripten-core/emscripten#15276 (comment)
* init * try to help WASM emscripten-core/emscripten#15276 * retry * fixup * fixup * testing wchar_t * testing no exceptions * testing exports * test for exports * test header only option, cpp file should be in include folder as well * Update xmake.lua * Update xmake.lua * Make wchar turned off by default --------- Co-authored-by: star9029 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I have a question wrt shared / dynamic linking.
While I can successful generated a shared library with emscripten when I use no build system with smth like
I cannot make cmake generate a shared / dynamic library.
I try to pass the required
SIDE_MODULE
flag viatarget_compile_options
/target_link_options
but I still get the error message that the the target platform does not support dynamic linking.I know that static libraries are recommended but I try to compile LLVM / clang / cling itself for emscripten and I need support for dlopen.
When I compile everything with static linking I do not get support for dlopen and get error messages when I use the generated code.
Is there any minimal example how to generate shared libs from cmake?
The text was updated successfully, but these errors were encountered: