-pthreads with an "s" is a typo, I think? clang ignores it: clang-13: warning: argument unused during compilation: '-pthreads' [-Wunused-command-line-argument]
But -pthread (no "s") is identical to -s USE_PTHREADS. Jasmeet, I think you need to debug your makefile. COMMON_CFLAGS may not reach the compile command. It may help to build one source file with EMCC_DEBUG=1 in the env to print out what compile command is run. On Sat, Apr 10, 2021 at 9:14 AM Jim Lloyd <[email protected]> wrote: > Note that > -pthreads > is not the same as > -s USE_PTHREADS > I believe you need both options. > On Apr 10 2021, at 7:07 am, Jasmeet Kaur <[email protected]> wrote: > >> hi, >> i updated the makefile: >> CC = emcc >> COMMON_CFLAGS += -Wall -pthread >> >> COMMON_CXXFLAGS += -I$(ROOT)/gui/ -I$(ROOT)/gui/GL/ -DNO_OPENGL -pthread >> >> But this doesnt seem to work. How do i pass the flag during compile time >> for Driver.o? >> >> >> On Thursday, April 8, 2021 at 5:51:51 PM UTC-4 [email protected] wrote: >> >>> My code has "-s: USE_PTHREADS" for both compile and link options. My >>> CMake uses this snippet: >>> >>> >>> if >>> (TARGET_WASM) >>> add_compile_options >>> ( >>> "SHELL:-s USE_PTHREADS" >>> ) >>> add_link_options( >>> "SHELL:-s USE_PTHREADS" >>> ) >>> endif >>> () >>> >>> >>> >>> On Apr 8 2021, at 2:45 pm, 'Thomas Lively' via emscripten-discuss < >>> [email protected]> wrote: >>> >>>> That's the link command, since Driver.o is one of the inputs. You need >>>> to pass -pthread at compile time, where Driver.o is created, as well. >>>> >>>> On Thu, Apr 8, 2021 at 1:26 PM Jasmeet Kaur <[email protected]> wrote: >>>> >>>>> I am using -pthread flag : (makefile) >>>>> COMMON_LNFLAGS += -Lapps/libs -Ldemos/libs -L/usr/X11R6/lib64 >>>>> -L/usr/X11R6/lib -pthread >>>>> >>>>> and here is the compilation output : >>>>> *emcc -o ../../../../html/debug/snakebird.js >>>>> ../../../../objs_html/snakebird.js/debug/apps/snakebird/Driver.o >>>>> -lenvironments -lmapalgorithms -lalgorithms -lgraphalgorithms -lgraph >>>>> -lutils -lguihtml -lgui -lSTUB -L../../../../html/debug -Lapps/libs >>>>> -Ldemos/libs -L/usr/X11R6/lib64 -L/usr/X11R6/lib -pthread -g -s >>>>> EXPORTED_FUNCTIONS="['_InitHOG', '_InitHOGArg', '_DoFrame', '_MouseEvent', >>>>> '_HitKey', '_SetCanvasSize']" -s EXTRA_EXPORTED_RUNTIME_METHODS=["cwrap"]* >>>>> *Live child 0x5633c6243c40 (../../../../html/debug/snakebird.js) PID >>>>> 22723* >>>>> *wasm-ld: error: --shared-memory is disallowed by >>>>> ../../../../objs_html/snakebird.js/debug/apps/snakebird/Driver.o because >>>>> it >>>>> was not compiled with 'atomics' or 'bulk-memory' features.* >>>>> >>>>> Is this not correct? >>>>> >>>>> On Thursday, April 8, 2021 at 4:17:10 PM UTC-4 [email protected] >>>>> wrote: >>>>> >>>>>> The object file specified in the error message was not compiled with >>>>>> -pthread, so atomic operations and thread-local data (if any) in its >>>>>> source >>>>>> were transformed to non-atomic operations and non-thread-local data. That >>>>>> transformation makes it unsafe to link that object into multi-threaded >>>>>> programs, so wasm-ld fails with that error message. The fix is to use >>>>>> -pthread when compiling that object. >>>>>> >>>>>> On Thu, Apr 8, 2021 at 1:11 PM Jasmeet Kaur <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Hi, >>>>>>> I am trying to use emscripton for a project. When I compile, I get >>>>>>> this error : >>>>>>> wasm-ld: error: --shared-memory is disallowed by .... because it was >>>>>>> not compiled with 'atomics' or 'bulk-memory' features. >>>>>>> Can someone point me as to how to resolve this? And also explain as >>>>>>> to why is this happening? >>>>>>> Environment info; >>>>>>> *emcc (Emscripten gcc/clang-like replacement + linker emulating GNU >>>>>>> ld) 2.0.16* >>>>>>> *clang version 13.0.0 >>>>>>> (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project >>>>>>> ad8010e598d9aa3747c34ce28aa2ba6de1650bd4)* >>>>>>> *Target: wasm32-unknown-emscripten* >>>>>>> *Thread model: posix* >>>>>>> >>>>>>> Thank you! >>>>>>> >>>>>>> -- >>>>>>> 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 [email protected]. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/emscripten-discuss/a9d08d47-9808-4205-bb71-e9990aa19cf7n%40googlegroups.com >>>>>>> <https://groups.google.com/d/msgid/emscripten-discuss/a9d08d47-9808-4205-bb71-e9990aa19cf7n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>> >>>>> -- >>>>> 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 [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/emscripten-discuss/83625760-2cf9-4185-95cf-b52ba0a5ab85n%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/emscripten-discuss/83625760-2cf9-4185-95cf-b52ba0a5ab85n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> >>>> -- >>>> 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 [email protected]. >>>> >>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EVySrEEkqKF36s95D8tHPu9j%2BX94w9dFOi_OdQnKbve_w%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/emscripten-discuss/CAJZD_EVySrEEkqKF36s95D8tHPu9j%2BX94w9dFOi_OdQnKbve_w%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/191be621-873e-432f-8cf7-2cb22f0cabe9n%40googlegroups.com >> <https://groups.google.com/d/msgid/emscripten-discuss/191be621-873e-432f-8cf7-2cb22f0cabe9n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/b46f4ee7-3f66-4e95-b139-b926c4a296a4%40edison.tech > <https://groups.google.com/d/msgid/emscripten-discuss/b46f4ee7-3f66-4e95-b139-b926c4a296a4%40edison.tech?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpTtVRYYK_UmTnsK0dTu6k2AM9%2B3Tpx51GXVvgqAZNehUQ%40mail.gmail.com.
