-
Notifications
You must be signed in to change notification settings - Fork 37.7k
depends: fix osx build with clang 16 #27328
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
Conversation
For some reason the previous syntax worked with clang 15 and below, but clang 16 requires that the option and value are properly separated.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
|
I'm not sure I see the connection? |
UPD. On Ubuntu 23.04, I've got:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested 87afcb0 on Ubuntu 23.04.
It fixes building make -C depends HOST=x86_64-apple-darwin FORCE_USE_SYSTEM_CLANG=1
with clang-16.
FWIW, with the following diff: --- a/depends/hosts/darwin.mk
+++ b/depends/hosts/darwin.mk
@@ -38,7 +38,9 @@ clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
llvm_config_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-config")
clang_resource_dir=$(shell clang -print-resource-dir)
+llvm_bin_dir=$(shell $(llvm_config_prog) --bindir)
llvm_lib_dir=$(shell $(llvm_config_prog) --libdir)
+darwin_LDFLAGS += -fuse-ld=$(llvm_bin_dir)/ld64.lld -Wl,-platform_version,macos,10.15,12.2
endif
cctools_TOOLS=AR RANLIB STRIP NM LIBTOOL OTOOL INSTALL_NAME_TOOL DSYMUTIL I'm able to build as follows:
The |
Yes, exactly this thanks. This can be verified very simply outside of depends:
Working:
Thanks, but the linking issue is totally unrelated to this one so I'd rather not get into that here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 87afcb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 87afcb0
My Guix builds:
0b0f331d84a16aa9b69227a0e6a59ded8087932b4131e003dbac1e15326b99f5 guix-build-87afcb0029b8/output/arm64-apple-darwin/SHA256SUMS.part
569257f2141e7c03cb2619a5b3baef81210f745d0f80c7531fc5b2e868fe7ade guix-build-87afcb0029b8/output/arm64-apple-darwin/bitcoin-87afcb0029b8-arm64-apple-darwin-unsigned.dmg
55d61448d3eb607bb607c14ecabd0109556fc8ecb769eb63c43479a6f7ef0d86 guix-build-87afcb0029b8/output/arm64-apple-darwin/bitcoin-87afcb0029b8-arm64-apple-darwin-unsigned.tar.gz
41f68c6ceacfaa2b9d5c4c3acc698812052c8d7e9da9762994b1a22d5c42b9f1 guix-build-87afcb0029b8/output/arm64-apple-darwin/bitcoin-87afcb0029b8-arm64-apple-darwin.tar.gz
201e8ad783b0d4d5ea78ca3b331a90edd48c7b0f664daf0968fcb7614877a1a1 guix-build-87afcb0029b8/output/dist-archive/bitcoin-87afcb0029b8.tar.gz
1f9e24641bebcad9865be0c3d0b78d089add38362711d07f4071a283cf9a78ac guix-build-87afcb0029b8/output/x86_64-apple-darwin/SHA256SUMS.part
a8a1972128f30ba2e5815c50c6303528a010b7a03f73e9443ac875bd3e5ada08 guix-build-87afcb0029b8/output/x86_64-apple-darwin/bitcoin-87afcb0029b8-x86_64-apple-darwin-unsigned.dmg
2d1bf1392cbd7a26b48f0b21f2c406746463a79ac2b27dea6296bf1ce1f69790 guix-build-87afcb0029b8/output/x86_64-apple-darwin/bitcoin-87afcb0029b8-x86_64-apple-darwin-unsigned.tar.gz
819e5c9d9f17e57ce36ed93ce0db50bb8d2a526667c8e3823b01104db24fe208 guix-build-87afcb0029b8/output/x86_64-apple-darwin/bitcoin-87afcb0029b8-x86_64-apple-darwin.tar.gz
87afcb0 depends: fix osx build with clang 16 (Cory Fields) Pull request description: 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](https://github.com/llvm/llvm-project/blob/main/clang/test/Driver/crash-report-with-asserts.c#L9). 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. ACKs for top commit: TheCharlatan: ACK 87afcb0 hebasto: ACK 87afcb0 Tree-SHA512: 127037c888c37c6ccd9679e96da34037cc43ccdc07915865a0a5494edb62633e83fc1bd6b1c4bb7a0322f5b59622e10090a31987f38496fb6b306488e9941594
d742be3 ci: Switch native macOS CI job to Xcode 15.0 (Hennadii Stepanov) 8decc5c build: Fix `-Xclang -internal-isystem` option (Hennadii Stepanov) Pull request description: This PR: - addresses #29165 (comment) - fixes #29174 ACKs for top commit: fanquake: ACK d742be3. The same as what was done in #27328. Tree-SHA512: 4788a0511e9fac638edab8e4f7ec62c5e08aeb07e518ab62fd53074ab3dd4eca1f62dc17c2af2b535bad12e77a7437e5c1c714cd03ce711e5d5e5c87d4620358
Summary: > 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. > depends: remove redundant stdlib option > > Use of -stdlib++-isystem gets rid of any system c++ header include paths and > negates the need for this option. In newer versions of clangs the combo > produces a warning. > depends: modernize clang flags > > Fixes builds with llvm >= 11 in guix by working around the problem. As a bonus, > this is much cleaner and more maintainable than what we had before. This is a backport of [[bitcoin/bitcoin#27328 | core#27328]], [[bitcoin/bitcoin#27721 | core#27721]] and [[bitcoin/bitcoin#27798 | core#27798]] The change to ci/test/00_setup_env_mac.sh in [[bitcoin/bitcoin#27798 | core#27798]] to ignore -Wunused-command-line-argument warnings seems equivalent to D3792 Test Plan: check that gitian-osx still works Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D15579
Current build (using forced system clang as a test) results in:
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.