cc-wrapper, clang-tools: move libcxx before cflags#185569
cc-wrapper, clang-tools: move libcxx before cflags#185569tjni wants to merge 1 commit intoNixOS:stagingfrom tjni:libstd-prefix-staging
Conversation
This fixes #163052, where the xcbuild build fails on Darwin after libSystem is added as a dependency of IOSurface. Even though cc-wrapper adds libc to NIX_CFLAGS_COMPILE using the -idirafter flag, ensuring it comes after the C++ standard library, and the clang-tools wrapper respects -idirafter when it parses arguments, it appears that "-isystem libc" can make its way onto NIX_CFLAGS_COMPILE too. In honesty, I have not been able to figure out how NIX_CFLAGS_COMPILE inherits "-isystem libSystem", or how it influences the xcbuild build itself. However: 1. This change does appear to fix the xcbuild build. 2. If NIX_CFLAGS_COMPILE does have "-isystem libSystem" added to it somehow, it _should_ probably come after the C++ standard library.
|
@toonn, would you be willing to skim this and share your thoughts or suggestions? My aim ultimately is to fix cargo-watch on my M1 Mac. |
|
I'm looking into this, |
|
Ok, the build did not fail for me without this change but I just noticed this is specific to aarch64-darwin... I'll ask whether someone can test this. |
@toonn, I'm running the build for |
|
Alright I ran, ~/C/nixpkgs on libstd-prefix-staging
❯ nix build -f . xcbuildwhich ran for about 45 minutes then failed when trying to build I then tried again with sandboxing enabled, ~/C/nixpkgs on libstd-prefix-staging
❯ nix --option sandbox true build -f . xcbuildand the build picked up where it left off, and finished after another couple of hours. Here's the log of the failed build for Failed dejagnu build log |
|
Building |
|
|
|
I have been preoccupied these last two days with both work and personal matters, so I'm sorry to all I have not been able to review your comments and feedback. I will as soon as I can next week. Thank you for your attention on this already.
Yes, you're exactly right. |
|
I had time today to revisit this issue. TLDR: I think the right thing to do is close this and pursue a different approach. Today, Within nixpkgs, dependencies are added to the include path using Now, #161561 adds an explicit dependency on I happen to like explicit dependencies, including on standard libraries, but I think the assumption is that the C and C++ standard libraries are provided implicitly unless the build takes over including both in the right order, for which packages are not set up. My current thinking is that it would be better to bring back #161561 by just removing |
|
Sounds like a reasonable (though unfortunate) compromise to me. |
This is #169962 rebased against the
stagingbranch.This fixes #163052, where the xcbuild build fails on Darwin after
libSystem is added as a dependency of IOSurface.
Even though cc-wrapper adds libc to NIX_CFLAGS_COMPILE using the
-idirafter flag, ensuring it comes after the C++ standard library,
and the clang-tools wrapper respects -idirafter when it parses
arguments, it appears that "-isystem libc" can make its way onto
NIX_CFLAGS_COMPILE too.
In honesty, I have not been able to figure out how NIX_CFLAGS_COMPILE
inherits "-isystem libSystem", or how it influences the xcbuild build
itself. However:
This change does appear to fix the xcbuild build.
If NIX_CFLAGS_COMPILE does have "-isystem libSystem" added to it
somehow, it should probably come after the C++ standard library.
Description of changes
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes