Closed Milerius closed 4 years ago
short solution: when multithread is enabled, please link Threads::Threads
to the library, not the example.
Emscripten support pthread so you can use if (UNIX OR EMSCRIPTEN)
instead of just if (UNIX)
Since I stoled your GitHub Actions configuration sometimes ago.
I added an emscripten build on ubuntu, if you want you can add it into yours to.
https://github.com/KomodoPlatform/antara-gaming-sdk/blob/master/.github/workflows/build.yml
So you will be able to compile your example in the web
Just to make sure I understand correctly, reproc++ needs to link against Threads::Threads
because the thread-safe string sink uses a mutex which needs the threading stuff to work?
I'll look into adding an emscripten build.
Not exactly.
Reproc++ need to link Threads::Threads when the option is enabled in the CMakelists.txt for emscripten otherwise the linker will be crazy
the emscripten
linker will look in your final program which object use pthread and which doesn't since it's javascript there is no notion of shared libraries all the symbols are regrouped. Since the pthread is missing in some object it's considers it unsafe by default
So with emscripten either all object files should be linked with -pthread
or none should be linked with -pthread
?
If that's the case, I'll just define remove the if(UNIX)
check for the REPROC_MULTITHREADED
option and link both reproc
and reproc++
against it if it is enabled.
Exactly we can ask @kripken but I'm 99% sure
So with emscripten either all object files should be linked with
-pthread
or none should be linked with-pthread
?If that's the case, I'll just define remove the
if(UNIX)
check for theREPROC_MULTITHREADED
option and link bothreproc
andreproc++
against it if it is enabled.
I think it's the best option. And we can check everything compile with GitHub Actions
If you want I can help you to have report.ci enabled in GitHub Actions too
So you can have nice report like me :p
I made the necessary changes. If REPROC_MULTITHREADED
is enabled, both reproc and reproc++ will link against the system's thread library.
The report would be overkill for reproc. I'd need more tests to actually get anything out of it.
Let me know if more changes are needed.
I will give it a try thank's and close the issue if it's working !
So with emscripten either all object files should be linked with -pthread or none should be linked with -pthread?
Yes, the linker will complain if you mix files with different wasm feature sets. So all files should be built with pthreads support, or none.
Thank's for the clarification !
working.
Resulting ld bug: