build: fix depends bdb compilation for BSDs#26073
Conversation
Currently, building bdb for *BSD HOSTs in depends fails with:
```bash
libtool: compile: clang -m64 -c -I. -I../dist/./.. -I/home/ubuntu/bitcoin/depends/x86_64-unknown-freebsd/include -D_THREAD_SAFE -pipe -std=c11 -O2 -Wno-error=implicit-function-declaration -Wno-error=format-security ../dist/./../mutex/mut_tas.c -fPIC -DPIC -o mut_tas.o
In file included from ../dist/./../mutex/mut_tas.c:11:
In file included from ./db_int.h:884:
In file included from ../dist/./../dbinc/mutex.h:15:
../dist/./../dbinc/mutex_int.h:932:2: error: unknown type name 'pthread_rwlock_t'
MUTEX_FIELDS /* Opaque thread mutex structures. */
^
../dist/./../dbinc/mutex_int.h:65:3: note: expanded from macro 'MUTEX_FIELDS'
pthread_rwlock_t rwlock; /* Read/write lock */ \
^
1 error generated.
```
Defining `_XOPEN_SOURCE` >=600 fixes access to the missing
`pthread_rwlock_t` definitions.
|
Has this always been broken, or is it a regression? |
I think it's always been broken, but haven't tested extensively. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
jarolrod
left a comment
There was a problem hiding this comment.
ACK 5b2529b
recreated by attempting to build for make HOST=x86_64-unknown-freebsd
and got the same error message on master:
../dist/./../dbinc/mutex_int.h:932:2: error: unknown type name 'pthread_rwlock_t'
MUTEX_FIELDS /* Opaque thread mutex structures. */
^
../dist/./../dbinc/mutex_int.h:65:3: note: expanded from macro 'MUTEX_FIELDS'
pthread_rwlock_t rwlock; /* Read/write lock */ \
^
with this pr i can properly configure and then build.
rw_lock is a part of POSIX.1-2001, making it a late addition; and reading the feature test macros manual, we do have to specify the minimum posix standard we need. Specifying _XOPEN_SOURCE is one way to do so and is the most appropriate way to do so here since the issue is isolated to this package.
5b2529b build: fix depends bdb compilation for BSDs (fanquake) Pull request description: Currently, building bdb for *BSD HOSTs in depends fails with: ```bash libtool: compile: clang -m64 -c -I. -I../dist/./.. -I/home/ubuntu/bitcoin/depends/x86_64-unknown-freebsd/include -D_THREAD_SAFE -pipe -std=c11 -O2 -Wno-error=implicit-function-declaration -Wno-error=format-security ../dist/./../mutex/mut_tas.c -fPIC -DPIC -o mut_tas.o In file included from ../dist/./../mutex/mut_tas.c:11: In file included from ./db_int.h:884: In file included from ../dist/./../dbinc/mutex.h:15: ../dist/./../dbinc/mutex_int.h:932:2: error: unknown type name 'pthread_rwlock_t' MUTEX_FIELDS /* Opaque thread mutex structures. */ ^ ../dist/./../dbinc/mutex_int.h:65:3: note: expanded from macro 'MUTEX_FIELDS' pthread_rwlock_t rwlock; /* Read/write lock */ \ ^ 1 error generated. ``` Defining `_XOPEN_SOURCE` >=600 fixes access to the missing `pthread_rwlock_t` definitions. ACKs for top commit: jarolrod: ACK 5b2529b Tree-SHA512: 76584bfef7a86c69a095eb722657aa681b95658a031ef2da79d91a616e5370da292a65e7d67cdf641711791422b8a407b647b630ad497ffb9908683479e6cfb6
Currently, building bdb for *BSD HOSTs in depends fails with:
Defining
_XOPEN_SOURCE>=600 fixes access to the missingpthread_rwlock_tdefinitions.