query
On this page

useLibsFrom

pkgs.useLibsFrom

Docs pulled from | This Revision | 35 minutes ago


Copy the libstdc++ from the model stdenv to the target stdenv. *

Inputs

modelStdenv

1. Function argument

targetStdenv

2. Function argument


Noogle detected

Implementation

The following is the current implementation of this function.

useLibsFrom = modelStdenv: targetStdenv:
    let
      ccForLibs = modelStdenv.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).
          *
          * Here we (ab)use it to use a `libstdc++` from a different `gcc` than our
          * `cc`.
          *
          * Note that this does not inhibit our `cc`'s lib dir from being added to
          * cflags/ldflags (see `cc_solib` in `cc-wrapper`) but this is okay: our
          * `gccForLibs`'s paths should take precedence.
        */
        useCcForLibs = true;
        gccForLibs = ccForLibs;
      };
    in
    overrideCC targetStdenv cc;