depends: fix osx build with clang 16 #27328

pull theuni wants to merge 1 commits into bitcoin:master from theuni:fix-depends-clang-16 changing 1 files +4 −4
  1. theuni commented at 8:48 pm on March 24, 2023: member

    Current build (using forced system clang as a test) results in:

    error: unknown argument: ‘-internal-externc-isystem/opt/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/include’

    For some reason the previous syntax worked with clang 15 and below, but clang 16 requires that the option and value are properly separated.

    See here for an example of upstream using this syntax.

    There is no change in behavior for previous versions.

    I’m seeing an additional unrelated problem with linking with system clang, but I’ll PR the solution to that separately as it’s not as straightforward as this.

  2. depends: fix osx build with clang 16
    For some reason the previous syntax worked with clang 15 and below, but
    clang 16 requires that the option and value are properly separated.
    87afcb0029
  3. DrahtBot commented at 8:48 pm on March 24, 2023: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK TheCharlatan, hebasto

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

  4. DrahtBot added the label Build system on Mar 24, 2023
  5. hebasto commented at 8:50 pm on March 24, 2023: member
    #27314? Not related. Sorry.
  6. theuni commented at 0:47 am on March 25, 2023: member

    #27314?

    I’m not sure I see the connection?

  7. hebasto commented at 10:50 am on March 25, 2023: member

    Current build (using forced system clang as a test) results in:

    error: unknown argument: ‘-internal-externc-isystem/opt/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/include’

    Mind providing steps to reproduce it, including your build environment details?

    UPD. On Ubuntu 23.04, I’ve got:

     0$ clang --version
     1Ubuntu clang version 16.0.0 (1~exp1ubuntu2)
     2Target: x86_64-pc-linux-gnu
     3Thread model: posix
     4InstalledDir: /usr/lib/llvm-16/bin
     5$ cd depends
     6$ make libevent HOST=x86_64-apple-darwin FORCE_USE_SYSTEM_CLANG=1
     7Configuring libevent...
     8checking for a BSD-compatible install... /usr/bin/install -c
     9checking whether build environment is sane... yes
    10checking for x86_64-apple-darwin-strip... x86_64-apple-darwin-strip
    11checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
    12checking for gawk... no
    13checking for mawk... mawk
    14checking whether make sets $(MAKE)... yes
    15checking whether make supports nested variables... yes
    16checking whether make supports nested variables... (cached) yes
    17checking whether make supports the include directive... yes (GNU style)
    18checking for x86_64-apple-darwin-gcc... env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /usr/lib/llvm-16/bin/clang --target=x86_64-apple-darwin -mmacosx-version-min=10.15 -B/home/hebasto/bitcoin/depends/x86_64-apple-darwin/native/bin -mlinker-version=609 -isysroot/home/hebasto/bitcoin/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers -Xclang -internal-externc-isystem/usr/lib/llvm-16/lib/clang/16/include -Xclang -internal-externc-isystem/home/hebasto/bitcoin/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include
    19checking whether the C compiler works... no
    20configure: error: in `/home/hebasto/bitcoin/depends/work/build/x86_64-apple-darwin/libevent/2.1.12-stable-e8d8ba5ae39':
    21configure: error: C compiler cannot create executables
    22See `config.log' for more details
    23make: *** [funcs.mk:292: /home/hebasto/bitcoin/depends/x86_64-apple-darwin/.libevent_stamp_configured] Error 77
    
  8. hebasto commented at 12:43 pm on March 25, 2023: member

    Tested 87afcb0029b8dab933c122fb8f7263c2e7272731 on Ubuntu 23.04.

    It fixes building make -C depends HOST=x86_64-apple-darwin FORCE_USE_SYSTEM_CLANG=1 with clang-16.

  9. hebasto commented at 2:44 pm on March 25, 2023: member

    I’m seeing an additional unrelated problem with linking with system clang, but I’ll PR the solution to that separately as it’s not as straightforward as this.

    FWIW, with the following diff:

     0--- a/depends/hosts/darwin.mk
     1+++ b/depends/hosts/darwin.mk
     2@@ -38,7 +38,9 @@ clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
     3 llvm_config_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-config")
     4 
     5 clang_resource_dir=$(shell clang -print-resource-dir)
     6+llvm_bin_dir=$(shell $(llvm_config_prog) --bindir)
     7 llvm_lib_dir=$(shell $(llvm_config_prog) --libdir)
     8+darwin_LDFLAGS += -fuse-ld=$(llvm_bin_dir)/ld64.lld -Wl,-platform_version,macos,10.15,12.2
     9 endif
    10 
    11 cctools_TOOLS=AR RANLIB STRIP NM LIBTOOL OTOOL INSTALL_NAME_TOOL DSYMUTIL
    

    I’m able to build as follows:

    0$ make -C depends HOST=x86_64-apple-darwin FORCE_USE_SYSTEM_CLANG=1 NO_QT=1 NO_WALLET=1 NO_ZMQ=1 NO_UPNP=1 NO_NATPMP=1
    1$ ./configure CONFIG_SITE=$PWD/depends/x86_64-apple-darwin/share/config.site --without-libs
    2$ make
    

    The lld package is required to be installed.

  10. theuni commented at 8:27 pm on March 26, 2023: member

    It fixes building make -C depends HOST=x86_64-apple-darwin FORCE_USE_SYSTEM_CLANG=1 with clang-16.

    Yes, exactly this thanks.

    This can be verified very simply outside of depends: Broken:

    $ /opt/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang -c test.c -o test.o -Xclang -internal-externc-isystem/tmp error: unknown argument: ‘-internal-externc-isystem/tmp’

    Working:

    $ /opt/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang -c test.c -o test.o -Xclang -internal-externc-isystem -Xclang /tmp


    I’m seeing an additional unrelated problem with linking with system clang, but I’ll PR the solution to that separately as it’s not as straightforward as this.

    FWIW, with the following diff:

    Thanks, but the linking issue is totally unrelated to this one so I’d rather not get into that here.

  11. TheCharlatan approved
  12. TheCharlatan commented at 8:42 pm on March 26, 2023: contributor
    ACK 87afcb0029b8dab933c122fb8f7263c2e7272731
  13. hebasto approved
  14. hebasto commented at 10:50 am on March 27, 2023: member

    ACK 87afcb0029b8dab933c122fb8f7263c2e7272731

    My Guix builds:

    00b0f331d84a16aa9b69227a0e6a59ded8087932b4131e003dbac1e15326b99f5  guix-build-87afcb0029b8/output/arm64-apple-darwin/SHA256SUMS.part
    1569257f2141e7c03cb2619a5b3baef81210f745d0f80c7531fc5b2e868fe7ade  guix-build-87afcb0029b8/output/arm64-apple-darwin/bitcoin-87afcb0029b8-arm64-apple-darwin-unsigned.dmg
    255d61448d3eb607bb607c14ecabd0109556fc8ecb769eb63c43479a6f7ef0d86  guix-build-87afcb0029b8/output/arm64-apple-darwin/bitcoin-87afcb0029b8-arm64-apple-darwin-unsigned.tar.gz
    341f68c6ceacfaa2b9d5c4c3acc698812052c8d7e9da9762994b1a22d5c42b9f1  guix-build-87afcb0029b8/output/arm64-apple-darwin/bitcoin-87afcb0029b8-arm64-apple-darwin.tar.gz
    4201e8ad783b0d4d5ea78ca3b331a90edd48c7b0f664daf0968fcb7614877a1a1  guix-build-87afcb0029b8/output/dist-archive/bitcoin-87afcb0029b8.tar.gz
    51f9e24641bebcad9865be0c3d0b78d089add38362711d07f4071a283cf9a78ac  guix-build-87afcb0029b8/output/x86_64-apple-darwin/SHA256SUMS.part
    6a8a1972128f30ba2e5815c50c6303528a010b7a03f73e9443ac875bd3e5ada08  guix-build-87afcb0029b8/output/x86_64-apple-darwin/bitcoin-87afcb0029b8-x86_64-apple-darwin-unsigned.dmg
    72d1bf1392cbd7a26b48f0b21f2c406746463a79ac2b27dea6296bf1ce1f69790  guix-build-87afcb0029b8/output/x86_64-apple-darwin/bitcoin-87afcb0029b8-x86_64-apple-darwin-unsigned.tar.gz
    8819e5c9d9f17e57ce36ed93ce0db50bb8d2a526667c8e3823b01104db24fe208  guix-build-87afcb0029b8/output/x86_64-apple-darwin/bitcoin-87afcb0029b8-x86_64-apple-darwin.tar.gz
    
  15. fanquake merged this on Mar 27, 2023
  16. fanquake closed this on Mar 27, 2023

  17. sidhujag referenced this in commit c2ee5e1bc3 on Mar 27, 2023
  18. fanquake referenced this in commit 9e1306fc88 on Jan 9, 2024
  19. Fabcien referenced this in commit 082d9ee179 on Mar 1, 2024
  20. bitcoin locked this on Mar 26, 2024

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-12-22 00:12 UTC

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