Skip to content
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

WASM: build fails for Emscripten 3.1.45+ #1266

Closed
yzakharchuk opened this issue Nov 17, 2023 · 1 comment · Fixed by #1271
Closed

WASM: build fails for Emscripten 3.1.45+ #1266

yzakharchuk opened this issue Nov 17, 2023 · 1 comment · Fixed by #1271
Assignees
Labels

Comments

@yzakharchuk
Copy link

I'm building oneTBB on Emscripten 3.1.45 as described in #1207 and getting the following error:

$ emcmake cmake -DCMAKE_CXX_COMPILER=em++ -DCMAKE_C_COMPILER=emcc -DTBB_STRICT=OFF -DCMAKE_CXX_FLAGS=-Wno-unused-command-line-argument -DTBB_DISABLE_HWLOC_AUTOMATIC_SEARCH=ON -DBUILD_SHARED_LIBS=ON -DTBB_EXAMPLES=ON -DTBB_TEST=ON ../oneTBB/
...

$ cmake --build . -j 8
[  0%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/backend.cpp.o
[  1%] Building CXX object test/CMakeFiles/test_handle_perror.dir/tbb/test_handle_perror.cpp.o
[  1%] Building CXX object examples/parallel_for/polygon_overlay/gui/CMakeFiles/UI_LIB_polygon_overlay.dir/convideo.cpp.o
[  1%] Building CXX object examples/parallel_for/tachyon/gui/CMakeFiles/UI_LIB_tachyon.dir/convideo.cpp.o
[  2%] Building CXX object examples/parallel_for/seismic/gui/CMakeFiles/UI_LIB_seismic.dir/convideo.cpp.o
[  2%] Building CXX object test/CMakeFiles/test_malloc_whitebox.dir/tbbmalloc/test_malloc_whitebox.cpp.o
[  3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o
[  3%] Building CXX object examples/task_arena/fractal/gui/CMakeFiles/UI_LIB_fractal.dir/convideo.cpp.o
clang++: error: unsupported option '-mrtm' for target 'wasm32-unknown-emscripten'
clang++: error: unsupported option '-mwaitpkg' for target 'wasm32-unknown-emscripten'
clang++: error: unsupported option '-mrtm' for target 'wasm32-unknown-emscripten'
clang++: error: unsupported option '-mwaitpkg' for target 'wasm32-unknown-emscripten'
em++: error: '/home/yurii/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN --sysroot=/home/yurii/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -Dtest_handle_perror_EXPORTS -I/home/yurii/oneTBB/test/.. -I/home/yurii/oneTBB/test -I/home/yurii/oneTBB/src/tbb/../../include -Wno-unused-command-line-argument -O2 -g3 -DNDEBUG -std=c++11 -Wall -Wextra -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor -ffp-model=precise -fexceptions -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -pthread -MD -MT test/CMakeFiles/test_handle_perror.dir/tbb/test_handle_perror.cpp.o -MF CMakeFiles/test_handle_perror.dir/tbb/test_handle_perror.cpp.o.d -c -matomics -mbulk-memory /home/yurii/oneTBB/test/tbb/test_handle_perror.cpp -o CMakeFiles/test_handle_perror.dir/tbb/test_handle_perror.cpp.o' failed (returned 1)
em++: error: '/home/yurii/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fvisibility=default -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN --sysroot=/home/yurii/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -D__TBB_BUILD -D__TBB_RESUMABLE_TASKS_USE_THREADS=1 -D__TBB_USE_ITT_NOTIFY -I/home/yurii/oneTBB/src/tbb/../../include -Wno-unused-command-line-argument -O2 -g3 -DNDEBUG -std=c++11 -flto=thin -Wall -Wextra -fexceptions -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -pthread -MD -MT src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o -MF CMakeFiles/tbb.dir/address_waiter.cpp.o.d -c -matomics -mbulk-memory /home/yurii/oneTBB/src/tbb/address_waiter.cpp -o CMakeFiles/tbb.dir/address_waiter.cpp.o' failed (returned 1)
clang++: error: unsupported option '-mrtm' for target 'wasm32-unknown-emscripten'
clang++: error: unsupported option '-mwaitpkg' for target 'wasm32-unknown-emscripten'
em++: error: '/home/yurii/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fvisibility=default -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN --sysroot=/home/yurii/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -D__TBBMALLOC_BUILD -D__TBB_USE_ITT_NOTIFY -I/home/yurii/oneTBB/src/tbbmalloc/../../include -Wno-unused-command-line-argument -O2 -g3 -DNDEBUG -std=c++11 -flto=thin -Wall -Wextra -fno-rtti -fno-exceptions -fexceptions -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -pthread -MD -MT src/tbbmalloc/CMakeFiles/tbbmalloc.dir/backend.cpp.o -MF CMakeFiles/tbbmalloc.dir/backend.cpp.o.d -c -matomics -mbulk-memory /home/yurii/oneTBB/src/tbbmalloc/backend.cpp -o CMakeFiles/tbbmalloc.dir/backend.cpp.o' failed (returned 1)
clang++: error: unsupported option '-mrtm' for target 'wasm32-unknown-emscripten'
clang++: error: unsupported option '-mwaitpkg' for target 'wasm32-unknown-emscripten'
em++: error: '/home/yurii/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN --sysroot=/home/yurii/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -D__TBBMALLOC_BUILD -I/home/yurii/oneTBB/test/../include -I/home/yurii/oneTBB/test/.. -I/home/yurii/oneTBB/test -Wno-unused-command-line-argument -O2 -g3 -DNDEBUG -std=c++11 -ffp-model=precise -fexceptions -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -fno-rtti -fno-exceptions -pthread -MD -MT test/CMakeFiles/test_malloc_whitebox.dir/tbbmalloc/test_malloc_whitebox.cpp.o -MF CMakeFiles/test_malloc_whitebox.dir/tbbmalloc/test_malloc_whitebox.cpp.o.d -c -matomics -mbulk-memory /home/yurii/oneTBB/test/tbbmalloc/test_malloc_whitebox.cpp -o CMakeFiles/test_malloc_whitebox.dir/tbbmalloc/test_malloc_whitebox.cpp.o' failed (returned 1)
gmake[2]: *** [src/tbbmalloc/CMakeFiles/tbbmalloc.dir/build.make:77: src/tbbmalloc/CMakeFiles/tbbmalloc.dir/backend.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:979: src/tbbmalloc/CMakeFiles/tbbmalloc.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[2]: *** [test/CMakeFiles/test_handle_perror.dir/build.make:77: test/CMakeFiles/test_handle_perror.dir/tbb/test_handle_perror.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:2799: test/CMakeFiles/test_handle_perror.dir/all] Error 2
gmake[2]: *** [src/tbb/CMakeFiles/tbb.dir/build.make:77: src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
[  3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o
[  3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena.cpp.o
gmake[2]: *** [test/CMakeFiles/test_malloc_whitebox.dir/build.make:77: test/CMakeFiles/test_malloc_whitebox.dir/tbbmalloc/test_malloc_whitebox.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:4151: test/CMakeFiles/test_malloc_whitebox.dir/all] Error 2
[  3%] Linking CXX static library ../../../../clang_18.0_cxx11_32_relwithdebinfo/libUI_LIB_fractal.a
[  3%] Linking CXX static library ../../../../clang_18.0_cxx11_32_relwithdebinfo/libUI_LIB_seismic.a
[  3%] Linking CXX static library ../../../../clang_18.0_cxx11_32_relwithdebinfo/libUI_LIB_tachyon.a
[  3%] Linking CXX static library ../../../../clang_18.0_cxx11_32_relwithdebinfo/libUI_LIB_polygon_overlay.a
clang++: error: unsupported option '-mrtm' for target 'wasm32-unknown-emscripten'
clang++: error: unsupported option '-mwaitpkg' for target 'wasm32-unknown-emscripten'
em++: error: '/home/yurii/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fvisibility=default -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN --sysroot=/home/yurii/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -D__TBB_BUILD -D__TBB_RESUMABLE_TASKS_USE_THREADS=1 -D__TBB_USE_ITT_NOTIFY -I/home/yurii/oneTBB/src/tbb/../../include -Wno-unused-command-line-argument -O2 -g3 -DNDEBUG -std=c++11 -flto=thin -Wall -Wextra -fexceptions -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -pthread -MD -MT src/tbb/CMakeFiles/tbb.dir/arena.cpp.o -MF CMakeFiles/tbb.dir/arena.cpp.o.d -c -matomics -mbulk-memory /home/yurii/oneTBB/src/tbb/arena.cpp -o CMakeFiles/tbb.dir/arena.cpp.o' failed (returned 1)
clang++: error: unsupported option '-mrtm' for target 'wasm32-unknown-emscripten'
clang++: error: unsupported option '-mwaitpkg' for target 'wasm32-unknown-emscripten'
gmake[2]: *** [src/tbb/CMakeFiles/tbb.dir/build.make:107: src/tbb/CMakeFiles/tbb.dir/arena.cpp.o] Error 1
em++: error: '/home/yurii/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fvisibility=default -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN --sysroot=/home/yurii/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -D__TBB_BUILD -D__TBB_RESUMABLE_TASKS_USE_THREADS=1 -D__TBB_USE_ITT_NOTIFY -I/home/yurii/oneTBB/src/tbb/../../include -Wno-unused-command-line-argument -O2 -g3 -DNDEBUG -std=c++11 -flto=thin -Wall -Wextra -fexceptions -mrtm -mwaitpkg -Wformat -Wformat-security -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -pthread -MD -MT src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o -MF CMakeFiles/tbb.dir/allocator.cpp.o.d -c -matomics -mbulk-memory /home/yurii/oneTBB/src/tbb/allocator.cpp -o CMakeFiles/tbb.dir/allocator.cpp.o' failed (returned 1)
gmake[2]: *** [src/tbb/CMakeFiles/tbb.dir/build.make:92: src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:953: src/tbb/CMakeFiles/tbb.dir/all] Error 2
[  3%] Built target UI_LIB_fractal
[  3%] Built target UI_LIB_seismic
[  3%] Built target UI_LIB_polygon_overlay
[  3%] Built target UI_LIB_tachyon
gmake: *** [Makefile:166: all] Error 2

All works fine for Emscripten 3.1.44 where unsupported options cause warnings that are suppressed with -Wno-unused-command-line-argument. I assume Emscripten 3.1.45+ uses clang 18 which treats unsupported options '-mrtm' and '-mwaitpkg' as an error.

@pavelkumbrasev
Copy link
Contributor

@JhaShweta1 Could you please taka a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants