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] 
> (mailto:[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] 
> > (mailto:[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] 
> > (mailto:[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] 
> (mailto:[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/d5c839cb-95ca-4749-8635-58e46e831582%40edison.tech.

Reply via email to