Closed
Description
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
em++ -c -fpic package_a/a.cpp -s SIDE_MODULE=1 -s EXPORT_ALL=1 -s LLD_REPORT_UNDEFINED -Ipackage_a -shared -o liba.wasm
I cannot make cmake generate a shared / dynamic library.
I try to pass the required SIDE_MODULE
flag via target_compile_options
/ target_link_options
but I still get the error message that the the target platform does not support dynamic linking.
add_library(${name} SHARED ${ALL_FILES})
SET(EMS_OPTS "-s SIDE_MODULE=1 -shared -s EXPORT_ALL=1 ")
target_compile_options(${name} PUBLIC ${EMS_OPTS})
target_link_options(${name} PUBLIC ${EMS_OPTS})
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
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?
Metadata
Metadata
Assignees
Labels
No labels