Skip to content
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

can't use nixpkgs_cc_configure on darwin with nixpkgs 24.11 #623

Open
flurie opened this issue Dec 1, 2024 · 3 comments
Open

can't use nixpkgs_cc_configure on darwin with nixpkgs 24.11 #623

flurie opened this issue Dec 1, 2024 · 3 comments
Labels
P0 blocker: fix immediately! type: bug

Comments

@flurie
Copy link

flurie commented Dec 1, 2024

Describe the bug
It looks like the changes made to improve the Darwin SDK situation have inadvertently broken using nixpkgs_cc_configure on darwin systems.

  Cannot build Nix derivation for package '@nixpkgs_config_cc_info'.
    Command: "/run/current-system/sw/bin/nix-build" "-I" "nixpkgs=/private/var/tmp/_bazel_flurie/329cba5e783b87d02ca74eb12aa46836/external/nixpkgs/nixpkgs" "/private/var/tmp/_bazel_flurie/329cba5e783b87d02ca74eb12aa46836/external/nixpkgs_config_cc_info/external/rules_nixpkgs_cc/cc.nix" "-A" "" "--out-link" "bazel-support/nix-out-link" "--argstr" "ccType" "ccTypeDefault" "--argstr" "ccLang" "c++" "--argstr" "ccStd" "c++2b"
    Return code: 1
    Error output: 
      > error:
      >        … while evaluating the 'name' attribute of a derivation
      > 
      >        … while evaluating a branch condition
      >          at /private/var/tmp/_bazel_flurie/329cba5e783b87d02ca74eb12aa46836/external/nixpkgs/lib/strings.nix:2627:3:
      >          2626|   # First detect the common case of already valid strings, to speed those up
      >          2627|   if stringLength string <= 207 && okRegex string != null
      >              |   ^
      >          2628|   then unsafeDiscardStringContext string
      > 
      >        … in the left operand of the AND (&&) operator
      >          at /private/var/tmp/_bazel_flurie/329cba5e783b87d02ca74eb12aa46836/external/nixpkgs/lib/strings.nix:2627:33:
      >          2626|   # First detect the common case of already valid strings, to speed those up
      >          2627|   if stringLength string <= 207 && okRegex string != null
      >              |                                 ^
      >          2628|   then unsafeDiscardStringContext string
      > 
      >        (stack trace truncated; use '--show-trace' to show the full, detailed trace)
      > 
      >        error: function 'anonymous lambda' called with unexpected argument 'postLinkSignHook'
      >        at /private/var/tmp/_bazel_flurie/329cba5e783b87d02ca74eb12aa46836/external/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix:8:1:
      >             7|
      >             8| { name ? ""
      >              | ^
      >             9| , lib

To Reproduce
For now you can pull https://github.com/flurie/aoc-2024 and repoint the cc to 24.11. I can produce a min repro if I have time and if it's needed.

Expected behavior
The rework looks pretty extensive, so I don't know that I expect it to work out of the box, but it does look like postLinkSignHook is no longer an overrideable scope, and it also looks like the patch has been incorporated upstream, so there's a chance it will work after removing that override.

Environment

  • OS name + version: maOS 14.5
  • Version of the code: master

Additional context
Add any other context about the problem here.

@flurie
Copy link
Author

flurie commented Dec 1, 2024

Pulling that out does get the toolchain running, though the linker is complaining about missing frameworks:

ld: warning: directory not found for option '-L/nix/store/3cxw7p5h5mirr1lg3gdh6p328jlaxw98-objc4-11.0/lib'
ld: warning: directory not found for option '-F/nix/store/8hb0c8qz2llmkiz1s3vri139qx9df9n4-CoreFoundation-11.0/Library/Frameworks'
ld: warning: directory not found for option '-F/nix/store/3llmr4gkn2rh00hqjack7cyn1j4cmyr1-CoreServices-11.0/Library/Frameworks'
ld: warning: directory not found for option '-F/nix/store/zc0avja428rnlxgivl00n668h0q075s3-Security-11.0/Library/Frameworks'
ld: warning: directory not found for option '-F/nix/store/fd5nwzagyaw6wfkcy3gbg4gxwv7jw5jh-Foundation-11.0/Library/Frameworks'
ld: warning: directory not found for option '-F/nix/store/m5v6d04rj306619lz913ng39m6v9bhfp-SystemConfiguration-11.0/Library/Frameworks'

@malt3 malt3 added the P0 blocker: fix immediately! label Dec 2, 2024
@malt3
Copy link
Collaborator

malt3 commented Dec 2, 2024

Thanks for opening the issue. I need to look into this a bit more deeply to try and understand the context.
Since we are preparing a new release with Bazel 8 support, it is a good time to also try and fix this.

@malt3
Copy link
Collaborator

malt3 commented Dec 17, 2024

@tshaynik found in the documentation that the individual frameworks we use (and add as linker flags) are now stubs:

The following source releases have been removed. They are no longer used to build the SDK. Their corresponding headers and stubs are included in the SDK.

Instead of providing separate SDK frameworks and libraries, they are bundled together in an SDK that can be used with xcrun and the xcbuild package.

Maybe removing all manually added frameworks from toolchains/cc/cc.nix will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 blocker: fix immediately! type: bug
Projects
None yet
Development

No branches or pull requests

2 participants