Compiling boost and icu

441 views
Skip to first unread message

Roman Savchenko

unread,
Aug 22, 2022, 8:37:59 AM8/22/22
to emscripten-discuss
Dear Emscripten developers,

I'm trying to compile boost with icu support and have some errors that I can't solve myself, so appreciate for a help.

I compiled ICU 67.1.0 as:

emconfigure ./configure --prefix=$PWD/build --disable-draft --disable-extras --disable-icuio --disable-layoutex --disable-tests --disable-samples --enable-static --disable-shared --with-data-packaging=archive
emmake make -j

It can not run "utility" executables, so I build ICU with gcc and copied them to source/bin folder. After that it generates: libicudata.a  libicui18n.a  libicutest.a  libicutu.a  libicuuc.a

Then I configured boost 1.73.0 as:
./bootstrap.sh --with-libraries=system,filesystem,regex,program_options,log,chrono,thread --with-icu=$ICU_ROOT
./b2 toolset=emscripten link=static threading=multi cflags="-s USE_PTHREADS=1" cxxflags="-std=c++11 -s USE_PTHREADS=1 -Wno-enum-constexpr-conversion" include=$ICU_ROOT/include library-path=$ICU_ROOT/lib

but has_icu test fails with:

emscripten.link bin.v2/libs/regex/build/emscripten-3.1.18/debug/threading-multi/visibility-hidden/has_icu.js
emcc:WARNING: --llvm-lto ignored when using llvm backend
emcc: warning: please replace -g4 with -gsource-map [-Wdeprecated]
wasm-ld: error: unknown argument: -Bstatic
 wasm-ld: error: unknown argument: -Bdynamic
 emcc: error: '/llvm-project/build/bin/wasm-ld -o bin.v2/libs/regex/build/emscripten-3.1.18/debug/threading-multi/visibility-hidden/has_icu.wasm -L/icu/source/build/bin -L/icu/source/build/lib bin.v2/libs/regex/build/emscripten-3.1.18/debug/threading-multi/visibility-hidden/has_icu_test.bc -Bstatic -Bdynamic /icu/source/build/lib/libicudata.a /icu/source/build/lib/libicui18n.a /icu/source/build/lib/libicuuc.a -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/crtbegin.o -lGL-mt -lal -lhtml5 -lstubs-debug -lnoexit -lc-mt-debug -ldlmalloc-mt -lcompiler_rt-mt -lc++-mt-noexcept -lc++abi-mt-noexcept -lsockets-mt -mllvm -combiner-global-alias-analysis=false     -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --import-memory --shared-memory --export-if-defined=main --export-if-defined=_emscripten_thread_init --export-if-defined=_emscripten_thread_exit --export-if-defined=_emscripten_thread_crashed --exp    ort-if-defined=_emscripten_tls_init --export-if-defined=pthread_self --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_f    ree --export=emscripten_stack_get_base --export=emscripten_stack_init --export=__cxa_demangle --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export=emscripten_dispatch_to_thread_ --export=_emscripte    n_thread_free_data --export=emscripten_main_browser_thread_id --export=emscripten_main_thread_process_queued_calls --export=emscripten_run_in_main_runtime_thread_js --export=emscripten_stack_set_limits --export=malloc --export=free --export=__dl_seterr --export=emscr    ipten_builtin_memalign --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (returned 1)

 "emcc"  -L"/icu/source/build/bin" -L"/icu/source/build/lib" -o "bin.v2/libs/regex/build/emscripten-3.1.18/debug/threading-multi/visibility-hidden/has_icu.js" "bin.v2/libs/regex/build/emscripten-3.1.18/debug/threading-multi/visibility-hid    den/has_icu_test.bc"  -Wl,--start-group -Wl,-Bstatic  -Wl,-Bdynamic -lrt -licudata -licui18n -licuuc -Wl,--end-group -fPIC -pthread -fvisibility=hidden -fvisibility-inlines-hidden -O0 --llvm-lto 0 -g4 -s DEMANGLE_SUPPORT=1

For the record I'm using Clang compiled from repo:
cmake -S llvm -B generated -G Ninja -DCMAKE_INSTALL_PREFIX=build -DLLVM_ENABLE_PROJECTS="lld;clang" -DLLVM_TARGETS_TO_BUILD="host;WebAssembly" -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=Off -DLLVM_INCLUDE_EXAMPLES=Off -DCMAKE_C
_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++

and .emscripten config set to LLVM_ROOT = '/llvm-project/build/bin'

Thanks for any advice,
Roman

Sam Clegg

unread,
Aug 22, 2022, 7:34:24 PM8/22/22
to emscripte...@googlegroups.com
It looks like the boost build system is adding `-Wl,-Bstatic  -Wl,-Bdynamic` on the command line but those flags are not compatible with wasm-ld.    I would imagine you need to modify the boost build system (b2) and stop it from adding those flags.

Regarding clang, in general you should not need to build it yourself (unless you want to) since we supply pre-built binaries as part of the emsdk.

cheers,
sam

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/3dd7937b-8ed9-4f0d-b5e6-6328d51c715en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages