depends: Fix compiling libevent package on NetBSD #31500

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:241214-libevent-netbsd changing 2 files +26 −1
  1. hebasto commented at 3:41 pm on December 14, 2024: member

    Libevent introduced the typeof C language extension in the NetBSD-specific code, which was pulled into our depends in #21991.

    However, GCC states:

    the various -std options disable certain keywords.

    Due to our use of https://github.com/bitcoin/bitcoin/blob/b042c4f0538c6f9cdf8efbcef552796851e38a85/depends/hosts/netbsd.mk#L1

    the typeof keyword is disabled, resulting in a compilation error:

     0$ gmake -C depends libevent CC=/usr/pkg/gcc14/bin/gcc CXX=/usr/pkg/gcc14/bin/g++
     1<snip>
     2[ 37%] Building C object CMakeFiles/event_core_static.dir/kqueue.c.o
     3/home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c: In function 'kq_setup_kevent':
     4/home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:56:27: error: implicit declaration of function 'typeof' [-Wimplicit-function-declaration]
     5   56 | #define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
     6      |                           ^~~~~~
     7/home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:190:30: note: in expansion of macro 'INT_TO_UDATA'
     8  190 |                 out->udata = INT_TO_UDATA(ADD_UDATA);
     9      |                              ^~~~~~~~~~~~
    10/home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:56:64: error: expected expression before 'intptr_t'
    11   56 | #define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
    12      |                                                                ^~~~~~~~
    13/home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:190:30: note: in expansion of macro 'INT_TO_UDATA'
    14  190 |                 out->udata = INT_TO_UDATA(ADD_UDATA);
    15      |                              ^~~~~~~~~~~~
    16/home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:56:27: error: called object is not a function or function pointer
    17   56 | #define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
    18      |                          ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    19/home/hebasto/dev/bitcoin/depends/work/build/x86_64-unknown-netbsd10.0/libevent/2.1.12-stable-ca6b96ec97c/kqueue.c:190:30: note: in expansion of macro 'INT_TO_UDATA'
    20  190 |                 out->udata = INT_TO_UDATA(ADD_UDATA);
    21      |                              ^~~~~~~~~~~~
    22gmake[3]: *** [CMakeFiles/event_core_static.dir/build.make:328: CMakeFiles/event_core_static.dir/kqueue.c.o] Error 1
    23<snip>
    

    This PR resolves this issue by following GCC’s recommendation:

    write __typeof__ instead of typeof.

  2. hebasto added the label Build system on Dec 14, 2024
  3. DrahtBot commented at 3:41 pm on December 14, 2024: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31500.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK fanquake

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. fanquake commented at 10:55 am on December 17, 2024: member
    Can you link to the upstream issue / PR.
  5. theuni commented at 5:08 pm on December 19, 2024: member

    LGTM, but yeah, it’d be helpful to upstream this.

    FWIW c23 adds typeof(), so technically guards for that could be added. Not worth the complexity though.

  6. hebasto commented at 4:08 pm on December 20, 2024: member

    Can you link to the upstream issue / PR.

    LGTM, but yeah, it’d be helpful to upstream this.

    Sure thing!

    Here is an upstream PR: https://github.com/libevent/libevent/pull/1768.

  7. depends: Fix compiling `libevent` package on NetBSD f89f16846e
  8. hebasto force-pushed on Feb 3, 2025
  9. hebasto commented at 9:22 am on February 3, 2025: member

    Can you link to the upstream issue / PR.

    LGTM, but yeah, it’d be helpful to upstream this.

    Sure thing!

    Here is an upstream PR: libevent/libevent#1768.

    The upstream changes have been merged. So this branch was rebased, and the upstream commit was mentioned.

  10. fanquake approved
  11. fanquake commented at 3:36 pm on February 12, 2025: member
    ACK f89f16846ec02942e7b81d24a85e3f40941e5426
  12. fanquake merged this on Feb 12, 2025
  13. fanquake closed this on Feb 12, 2025

  14. hebasto deleted the branch on Feb 12, 2025
  15. hebasto referenced this in commit 0829709c97 on Feb 12, 2025
  16. sedited referenced this in commit f78a01a560 on Feb 22, 2025
  17. fanquake referenced this in commit 51fbcba682 on Mar 5, 2025
  18. glozow referenced this in commit dbc450c1b5 on Mar 5, 2025
  19. stickies-v referenced this in commit d760fd3dda on Mar 17, 2025
  20. stickies-v referenced this in commit cc83553352 on Mar 17, 2025
  21. stickies-v referenced this in commit 2614933f06 on Mar 17, 2025
  22. stickies-v referenced this in commit b70418c5fc on Mar 17, 2025
  23. stickies-v referenced this in commit 69f8a1fe50 on Mar 17, 2025
  24. bug-castercv502 referenced this in commit d15545ffaa on Sep 28, 2025
  25. kwvg referenced this in commit 69781f493f on Oct 24, 2025
  26. kwvg referenced this in commit 49b4dfef70 on Oct 24, 2025
  27. kwvg referenced this in commit cbf84d1814 on Oct 24, 2025
  28. kwvg referenced this in commit 0e9d0f1094 on Oct 25, 2025
  29. kwvg referenced this in commit 614a63fc36 on Oct 25, 2025
  30. kwvg referenced this in commit 422b54300b on Oct 31, 2025
  31. kwvg referenced this in commit 3dd5c1c4ab on Nov 3, 2025
  32. PastaPastaPasta referenced this in commit eea343b266 on Nov 4, 2025
  33. bitcoin locked this on Feb 12, 2026

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: 2026-02-17 21:13 UTC

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