openh264 icon indicating copy to clipboard operation
openh264 copied to clipboard

Build without thread support

Open Lunatix89 opened this issue 4 years ago • 1 comments

I am using this library in a project which decodes a H264 stream in Javascript / WebAssembly but due to Meltdown and Spectre it is very complicated to use pthread with emscripten in Firefox and Safari (see https://dzone.com/articles/webassembly-threads-in-firefox if you are interested about the topic).

My question is now, since I'm only using the decoder: would it be possible to disable thread support at all?
I've tried building without the "-pthread" flag but I get link errors when linking the "main executable" with emscripten.

error: undefined symbol: pthread_attr_setschedpolicy (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _pthread_attr_setschedpolicy may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: pthread_attr_setscope (referenced by top-level compiled C/C++ code)
warning: _pthread_attr_setscope may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: sem_timedwait (referenced by top-level compiled C/C++ code)
warning: _sem_timedwait may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: '/emsdk/node/12.18.1_64bit/bin/node /emsdk/upstream/emscripten/src/compiler.js /tmp/tmp7yki8dj2.txt' failed (1)

Lunatix89 avatar Mar 11 '21 13:03 Lunatix89

openh264 does not have such kind of thread support scripts. You'd better see how the build script changes the command into openh264 build info.

huili2 avatar Dec 16 '22 05:12 huili2