CMake with emscripten build - undefined symbol: _embind_register_class #19973
-
I am the maintainer of this project: https://github.com/brandonmpetty/Doxa I have had really great luck using emscripten in the past, and I want to further improve that experience by automating the build process using CMake. This CMake script will download the latest version of EMScripten, install it, and then build my WASM... except I am getting a linker error on that last part. So, my tradition command line way was:
My CMake looks like this
My errors:
Do you see anything obvious I am missing? I tried copying the COMPILE_FLAGS for LINK_FLAGS just to see, but that didn't help. I am pretty new to CMake, so I am open to all suggestions. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I highly recommend using I'm imagining the problem is that (If you want to keep using |
Beta Was this translation helpful? Give feedback.
-
Thank you @sbc100, that was exactly it.
One followup question. The size of the output js and wasm between the CMake version and the em++ cmd line version seem large. It feels like I am over looking something. I'll try Ninja and checkout the verbose option to see what could be different between the two. |
Beta Was this translation helpful? Give feedback.
I highly recommend using
ninja
rather thanmake
when usingcmake
. You can do this-G Ninja
on the cmake command line. One of the advantages of using ninja is that when a command fails (such as the link command in this case) , it shows you the failing command. As it stands you cannot see theem++
command that failed.I'm imagining the problem is that
--bind
is not being specified as a linker flag. I think you need to move most those flags fromCOMPILE_FLAGS
toLINK_FLAGS
. Only-O3 -std=c++17
looks like compile flags to me.(If you want to keep using
make
then I think you can run withcmake --build build --verbose
to have to output the full command lines).