-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpp runtime: Remove pthread dependency. #4086
Conversation
2285791
to
dcaa0be
Compare
@Krzmbrzl WDYT? |
Sounds good to me. Option 1) would be an issue imo, because it restricts usability of ANTLR to somewhat recent systems only. However, implementing this ourselves appears as a solid workaround for our use case 👍 |
dcaa0be
to
ca508be
Compare
It now links against pthread, and this is not supported directly by emscriten. Downgrading the ANTLR version fixed the problem. Long-term, I submitted a PR against ANTLR to fix the issue: antlr/antlr4#4086
It now links against pthread, and this is not supported directly by emscriten. Downgrading the ANTLR version fixed the problem. Long-term, I submitted a PR against ANTLR to fix the issue: antlr/antlr4#4086
ANTLR doesn't use threads, and it used not to depend on pthread library either. It changed recently in 2022: antlr#3708 The patch linked against pthread, because the GNU libstdc++ used to depend on it in their implementation of `std::call_once`. By the way, the libstdc++ stopped it in 2020: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=93e79ed391b9c636f087e6eb7e70f14963cd10ad So this is not more needed. I would like to stop depending on pthread. I am using ANTLR in C++ WebAssembly for the website: https://arthursonzogni.com/Diagon/ It doesn't compile with emscripten anymore, because by default pthread is not enabled. It could be enabled, but it would force me to deploy cross-origin-isolation: https://web.dev/cross-origin-isolation-guide/ Solutions: 1. Stop linking against pthread, because the libstdc++ stopped depending on it for std::call_once. 2. Implement std::call_once ourself using std::atomic_flag 3. Implement std::call_once ourself using a boolean flag, assuming we don't need to support threads. I chose to do (2) in this patch. Signed-off-by: ArthurSonzogni <sonzogniarthur@gmail.com>
ca508be
to
d36e2b9
Compare
Okay. Then, I think this is ready. Thanks! |
Thanks! |
Hmm..seems we have a failure: https://github.com/antlr/antlr4/actions/runs/4031407036/jobs/6930678126
|
I'll retry it. |
Thanks for the code review! |
damn. this was on master not dev. |
This reverts commit 2073147.
Can you base this on latest dev and resubmit? thanks. @ArthurSonzogni |
ANTLR doesn't use threads, and it used not to depend on pthread library either.
It changed recently in 2022: #3708 The patch linked against pthread, because the GNU libstdc++ used to depend on it in their implementation of
std::call_once
.By the way, the libstdc++ stopped it in 2020:
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=93e79ed391b9c636f087e6eb7e70f14963cd10ad So this is not more needed.
I would like to stop depending on pthread. I am using ANTLR in C++ WebAssembly for the website:
https://arthursonzogni.com/Diagon/
It doesn't compile with emscripten anymore, because by default pthread is not enabled. It could be enabled, but it would force me to deploy cross-origin-isolation:
https://web.dev/cross-origin-isolation-guide/
Solutions:
I chose to do (2) in this patch.