build: fix depends bdb compilation for BSDs #26073

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:_BSD_bdb_compilation changing 1 files +3 −0
  1. fanquake commented at 11:17 am on September 13, 2022: member

    Currently, building bdb for *BSD HOSTs in depends fails with:

     0libtool: 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
     1In file included from ../dist/./../mutex/mut_tas.c:11:
     2In file included from ./db_int.h:884:
     3In file included from ../dist/./../dbinc/mutex.h:15:
     4../dist/./../dbinc/mutex_int.h:932:2: error: unknown type name 'pthread_rwlock_t'
     5        MUTEX_FIELDS                    /* Opaque thread mutex structures. */
     6        ^
     7../dist/./../dbinc/mutex_int.h:65:3: note: expanded from macro 'MUTEX_FIELDS'
     8                pthread_rwlock_t rwlock;        /* Read/write lock */   \
     9                ^
    101 error generated.
    

    Defining _XOPEN_SOURCE >=600 fixes access to the missing pthread_rwlock_t definitions.

  2. build: fix depends bdb compilation for BSDs
    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.
    5b2529b269
  3. fanquake added the label Build system on Sep 13, 2022
  4. luke-jr commented at 11:30 pm on September 19, 2022: member
    Has this always been broken, or is it a regression?
  5. fanquake commented at 8:38 am on September 20, 2022: member

    Has this always been broken, or is it a regression?

    I think it’s always been broken, but haven’t tested extensively.

  6. fanquake marked this as ready for review on Sep 21, 2022
  7. DrahtBot commented at 3:52 am on September 23, 2022: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    No conflicts as of last run.

  8. jarolrod approved
  9. jarolrod commented at 6:51 pm on October 10, 2022: member

    ACK 5b2529b2697e9b2675783c98a32a41e28c72e076

    recreated by attempting to build for make HOST=x86_64-unknown-freebsd

    and got the same error message on master:

    0../dist/./../dbinc/mutex_int.h:932:2: error: unknown type name 'pthread_rwlock_t'
    1        MUTEX_FIELDS                    /* Opaque thread mutex structures. */
    2        ^
    3../dist/./../dbinc/mutex_int.h:65:3: note: expanded from macro 'MUTEX_FIELDS'
    4                pthread_rwlock_t rwlock;        /* Read/write lock */   \
    5                ^
    

    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.

  10. fanquake merged this on Nov 28, 2022
  11. fanquake closed this on Nov 28, 2022

  12. fanquake deleted the branch on Nov 28, 2022
  13. sidhujag referenced this in commit ba7a879fd5 on Dec 1, 2022
  14. bitcoin locked this on Nov 28, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-03 10:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me