Skip to content
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

Link wampcc against pthreads on Linux #78

Merged
merged 1 commit into from
Sep 23, 2023
Merged

Conversation

samangh
Copy link
Contributor

@samangh samangh commented Sep 8, 2023

When using the version version of wampcc in Linux (but not on Windows), I came across this error:

[ 50%] Building CXX object router/CMakeFiles/router.dir/src/main.cpp.o
[100%] Linking CXX executable router
/usr/lib/gcc/x86_64-nilrt-linux/10.3.0/../../../../x86_64-nilrt-linux/bin/ld: /opt/wampcc/lib64/libwampcc.a(event_loop.cc.o): undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-nilrt-linux/10.3.0/../../../../x86_64-nilrt-linux/bin/ld: /lib64/libpthread.so.0: error adding symbols: DSO missing from command line

It looks like something in even_loop.cc has a direct or indirect dependency on pthreads. I suspect that this was always there, but in previous version of libstdc there was a bug: if pthread was not linked against then there was no error message sometimes (see pull request #74).

This pull request links agasinst pthreads on Linux/Unix and solved the above error.

This is because in some versions of libstdc   (at least on 10.2.1),
`std::condition_variable::wait_for()` is implemented using
`pthread_cond_clockwait()`, and so one needs to link against pthreads.

Although this linking was always required, in previous version of
libstdc   there was a bug: if pthread was not linked against then there
was no error message but `std::condition_variable::wait_for()` would
immediately return.
@darrenjs darrenjs merged commit cb9c6bc into darrenjs:master Sep 23, 2023
@samangh samangh deleted the pthread branch September 23, 2023 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants