Skip to content

Commit

Permalink
stdenvAdapters.useLibsFrom: use targetStdenv.cc.override
Browse files Browse the repository at this point in the history
As @SomeoneSerge pointed out in #281371 (comment),
by avoiding `wrapCCWith` and using `targetStdenv.cc.override`, we avoid roundtrip wrapping and
are able to use `coreutils` from `targetStdenv`.
  • Loading branch information
Connor Baker committed Mar 20, 2024
1 parent f252205 commit e871fcf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkgs/stdenv/adapters.nix
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,18 @@ rec {
});
});

/* Copy the libstdc++ from the model stdenv to the target stdenv.
*
* TODO(@connorbaker):
* This interface provides behavior which should be revisited prior to the
* release of 24.05. For a more detailed explanation and discussion, see
* https://github.com/NixOS/nixpkgs/issues/283517. */
useLibsFrom = modelStdenv: targetStdenv:
let
ccForLibs = modelStdenv.cc.cc;
cc = pkgs.wrapCCWith {
/* NOTE: cc.cc is the unwrapped compiler. Should we respect the old
* wrapper instead? */
cc = targetStdenv.cc.cc;

/* NOTE(@connorbaker):
* This assumes targetStdenv.cc is a cc-wrapper. */
cc = targetStdenv.cc.override {
/* NOTE(originally by rrbutani):
* Normally the `useCcForLibs`/`gccForLibs` mechanism is used to get a
* clang based `cc` to use `libstdc++` (from gcc).
Expand Down

0 comments on commit e871fcf

Please sign in to comment.