Thank you all for your support. I was able to successfully compile my project with pthread enabled. Now I face a new problem, I used Module._malloc to pass an image from a webcam into my cpp function For that I used the following linker flags: add_link_options(-sINITIAL_MEMORY=800MB -sTOTAL_STACK=80MB -O3 -s -sEXPORTED_FUNCTIONS=['_malloc','_free'] -sASSERTIONS -pthread)
Now I get the following error in my console: Uncaught ReferenceError: SharedArrayBuffer is not defined at blink_landmark_detector_sample.js:1:9999 (index):11 Uncaught TypeError: Module._malloc is not a function at _arrayToHeap ((index):11:24) at HTMLVideoElement.computeFrame ((index):40:22) Any idea what happened? Thanks! Ronny ב-יום שלישי, 18 ביולי 2023 בשעה 16:06:32 UTC+3, tli...@google.com כתב/ה: > If you look at your CMake script, you should see that it adds -flto at > some point. That’s the option you’ll want to remove. You may be able to > remove it from your CMakeCache.txt file and recompile without running cmake > again. > > On Tue, Jul 18, 2023 at 01:33 Ronny Nissengold <ronn...@gmail.com> wrote: > >> Thank you for your response. How do I turn off LTO? >> >> ב-יום שני, 17 ביולי 2023 בשעה 18:51:26 UTC+3, tli...@google.com כתב/ה: >> >>> This error means that some code wasn't compiled with -pthread and >>> therefore is not safe to execute in a multithreaded environment. Normally >>> the error message tells you which object is the culprit, but it's less >>> helpful here because you're using LTO. Does the problem persist if you turn >>> off LTO? >>> >>> On Mon, Jul 17, 2023 at 8:49 AM Ronny Nissengold <ronn...@gmail.com> >>> wrote: >>> >>>> Hi all! >>>> I am trying to use multithreading in my project. >>>> I got this error when passing -pthread both to compiler and linker. >>>> I am using cmake. >>>> Any idea how to overcome this? >>>> Thanks! >>>> >>>> -- >>>> 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/acbc873e-078a-4082-8761-6c0322246170n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/emscripten-discuss/acbc873e-078a-4082-8761-6c0322246170n%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 emscripten-disc...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/3c0a9c3c-9e56-41e4-9211-38afba0fc2c2n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/emscripten-discuss/3c0a9c3c-9e56-41e4-9211-38afba0fc2c2n%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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/7a6ad0e5-3eea-4d56-8aff-d1baa78e0127n%40googlegroups.com.