emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
3.03k stars 693 forks source link

wasm-ld: error: 'atomics' feature is disallowed #1087

Open nsourligas opened 2 years ago

nsourligas commented 2 years ago

Hi,

I am trying to compile my Qt5 application (using protobuf) into wasm following Qt instructions. But the compilation fails at the last generated file which is the application js file. Any idea why this is happening?

root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 wasm-ld: error: 'atomics' feature is disallowed by main.o, so --shared-memory must not be used wasm-ld: error: Target feature 'atomics' used in common.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in int128.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in status.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in stringpiece.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in arena.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in arenastring.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in extension_set.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in generated_message_util.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in strutil.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in message_lite.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in structurally_valid.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in parse_context.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in implicit_weak_message.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in repeated_field.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in stringprintf.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in wire_format_lite.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in coded_stream.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in zero_copy_stream.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: Target feature 'atomics' used in zero_copy_stream_impl.o is disallowed by main.o. Use --no-check-features to suppress. wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

sbc100 commented 2 years ago

I looks like you didn't compile your main.c or main.cpp file with -pthread (or -sUSE_PTHREADS).

sbc100 commented 2 years ago

With pthread programs all source files (technically all source files that use atomics and/or TLS) need to be compiled with this flag.

nsourligas commented 2 years ago

@sbc100

Even though it seems that I am compiling all the source files with the option -s USE_PTHREADS or -pthread now the same compilation errors as shown below appeared (setting WASM_MEM_MAX didn't change anything):

em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o main.o ../suntracker3-qt5/main.cpp em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o Tracking.o ../suntracker3-qt5/Tracking.cpp em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o WindSpeed.o ../suntracker3-qt5/WindSpeed.cpp em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o WindGraph.o ../suntracker3-qt5/WindGraph.cpp em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o WindGraphPoint.o ../suntracker3-qt5/WindGraphPoint.cpp em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o FrontendInfo.o ../suntracker3-qt5/FrontendInfo.cpp em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o TrackerMatrix.o ../suntracker3-qt5/TrackerMatrix.cpp em++ -c -pipe -s USE_PTHREADS -O2 -std=gnu++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -Wextra -DWEB_ASSEMBLY -DQT_NO_DEBUG -DQT_QUICKCONTROLS2_LIB -DQT_VIRTUALKEYBOARD_LIB -DQT_QUICK_LIB -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../suntracker3-qt5 -I. -I/usr/local/include -I../suntracker3-qt5/proto/frontend -I/opt/Qt/5.15.0/wasm_32/include -I/opt/Qt/5.15.0/wasm_32/include/QtQuickControls2 -I/opt/Qt/5.15.0/wasm_32/include/QtVirtualKeyboard -I/opt/Qt/5.15.0/wasm_32/include/QtQuick -I/opt/Qt/5.15.0/wasm_32/include/QtCharts -I/opt/Qt/5.15.0/wasm_32/include/QtWidgets -I/opt/Qt/5.15.0/wasm_32/include/QtGui -I/opt/Qt/5.15.0/wasm_32/include/QtQmlModels -I/opt/Qt/5.15.0/wasm_32/include/QtQml -I/opt/Qt/5.15.0/wasm_32/include/QtWebSockets -I/opt/Qt/5.15.0/wasm_32/include/QtNetwork -I/opt/Qt/5.15.0/wasm_32/include/QtCore -I. -I/home/nikolaos.sourligkas/.emscripten_ports/openssl/include -I/opt/Qt/5.15.0/wasm_32/mkspecs/wasm-emscripten -o TrackerTelemetry.o ../suntracker3-qt5/TrackerTelemetry.cpp root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set Makefile:2451: recipe for target 'WindGraph.o' failed root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set make: [WindGraph.o] Error 1 make: Waiting for unfinished jobs.... root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set Makefile:2249: recipe for target 'Tracking.o' failed make: [Tracking.o] Error 1 root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set Makefile:2702: recipe for target 'FrontendInfo.o' failed make: [FrontendInfo.o] Error 1 Makefile:2149: recipe for target 'main.o' failed make: [main.o] Error 1 Makefile:2349: recipe for target 'WindSpeed.o' failed make: [WindSpeed.o] Error 1 root:WARNING: USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 shared:ERROR: If pthreads and memory growth are enabled, WASM_MEM_MAX must be set Makefile:2551: recipe for target 'WindGraphPoint.o' failed make: [WindGraphPoint.o] Error 1 Makefile:2904: recipe for target 'TrackerTelemetry.o' failed make: [TrackerTelemetry.o] Error 1 Makefile:2804: recipe for target 'TrackerMatrix.o' failed make: *** [TrackerMatrix.o] Error 1 11:55:15: The process "/usr/bin/make" exited with code 2. Error while building/deploying project suntracker3-qt5 (kit: Qt 5.15.0 WebAssembly) When executing step "Make" 11:55:15: Elapsed time: 00:00.