emscripten
emscripten copied to clipboard
Failing to link boost libs on Make
Version of emscripten/emsdk: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.10 (c3fe57af0504fe24fc4ba697feb8c204f3c80022) clang version 15.0.0 (https://github.com/llvm/llvm-project 8bc29d14273b05b05d5a56e34c07948dc2c770d3) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /root/emsdk/upstream/bin
I followed the last comment for building boost with emscripten before compiling/linking with my sample project:
https://stackoverflow.com/questions/15724357/using-boost-with-emscripten
Failing command line in full:
root@589b08873bb9:~/workspace/sample/bin# make
[ 50%] Linking CXX executable main.js
em++: warning: unrecognized file type: `/usr/local/lib/libboost_unit_test_framework.so`. Mapping to `-lboost_unit_test_framework` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_iostreams.so`. Mapping to `-lboost_iostreams` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_system.so`. Mapping to `-lboost_system` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_serialization.so`. Mapping to `-lboost_serialization` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_thread.so`. Mapping to `-lboost_thread` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_program_options.so`. Mapping to `-lboost_program_options` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_filesystem.so`. Mapping to `-lboost_filesystem` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_regex.so`. Mapping to `-lboost_regex` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_chrono.so`. Mapping to `-lboost_chrono` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_date_time.so`. Mapping to `-lboost_date_time` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/usr/local/lib/libboost_atomic.so`. Mapping to `-lboost_atomic` and hoping for the best [-Wmap-unrecognized-libraries]
wasm-ld: error: unable to find library -lboost_unit_test_framework
wasm-ld: error: unable to find library -lboost_iostreams
wasm-ld: error: unable to find library -lboost_system
wasm-ld: error: unable to find library -lboost_serialization
wasm-ld: error: unable to find library -lboost_thread
wasm-ld: error: unable to find library -lboost_program_options
wasm-ld: error: unable to find library -lboost_filesystem
wasm-ld: error: unable to find library -lboost_regex
wasm-ld: error: unable to find library -lboost_chrono
wasm-ld: error: unable to find library -lboost_date_time
wasm-ld: error: unable to find library -lboost_atomic
em++: error: '/root/emsdk/upstream/bin/wasm-ld -o main.wasm CMakeFiles/main.dir/main.cpp.o -lboost_unit_test_framework -lboost_iostreams -lboost_system -lboost_serialization -lboost_thread -lboost_program_options -lboost_filesystem -lboost_regex -lboost_chrono -lboost_date_time -lboost_atomic -L/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (returned 1)
make[2]: *** [code/CMakeFiles/main.dir/build.make:98: code/main.js] Error 1
make[1]: *** [CMakeFiles/Makefile2:94: code/CMakeFiles/main.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
Hi, I am getting exactly the same error for my project. Any progress or solution here?
emsdk requires linking to archives that it has built, because that's likely the only place you'll have wasm archives. @sbc100, you might want to close this one.
Exactly, if you want to use those boost libraries you would need to build them yourself. Generally speaking you cannot use any libraries from the host (e.g. /usr/lib or /usr/local/lib).