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

pthreads related build error in SLES 11 for version 1.23.0 (PTHREAD_MUTEX_RECURSIVE and pthread_mutexattr_settype undeclared) #644

Closed
rainerjung opened this issue Dec 3, 2023 · 2 comments

Comments

@rainerjung
Copy link

On SLES 11 file src/lib/ares__threads.c does not compile for version 1.23.0:

ares__threads.c: In function 'ares__thread_mutex_create':
ares__threads.c:94: warning: implicit declaration of function 'pthread_mutexattr_settype'
ares__threads.c:94: warning: nested extern declaration of 'pthread_mutexattr_settype'
ares__threads.c:94: error: 'PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)
ares__threads.c:94: error: (Each undeclared identifier is reported only once
ares__threads.c:94: error: for each function it appears in.)

Although pthread.h is included, it seems for such old Linux version one needs to either define _GNU_SOURCE or _XOPEN_SOURCE 700. For me it was sufficient to do that in ares__threads.c.

@bradh352
Copy link
Member

bradh352 commented Dec 3, 2023

I assuming you're using autotools and not cmake then? I'm showing with CMake at least _GNU_SOURCE is defined. And does it really need _XOPEN_SOURCE=700? Looks like we're setting 600.

@rainerjung
Copy link
Author

Thank you for fixing this. Yes, I used configure and make, so the autotools generated files from the source tarball. I did not regenerate those.

bradh352 added a commit that referenced this issue Dec 4, 2023
Certain defines are needed on some systems to enable functionality like
pthread recursive mutexes.

Fixes #644
Fix By: Brad House (@bradh352)
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

No branches or pull requests

2 participants