Unverified Commit 8eda4c36 authored by Someone Serge's avatar Someone Serge
Browse files

cc-wrapper: cxxStdlib: expose solib and package separately

parent 210ce384
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -110,6 +110,9 @@ let
  gccForLibs_solib = getLib gccForLibs
    + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";

  # Analogously to cc_solib and gccForLibs_solib
  libcxx_solib = "${lib.getLib libcxx}/lib";

  # The following two functions, `isGccArchSupported` and
  # `isGccTuneSupported`, only handle those situations where a flag
  # (`-march` or `-mtune`) is accepted by one compiler but rejected
@@ -270,14 +273,14 @@ stdenv.mkDerivation {
        givenGccForLibs = useGccForLibs && gccForLibs.langCC or false;
      in
      if (!givenLibcxx) && givenGccForLibs then
        { kind = "libstdc++"; lib = gccForLibs; }
        { kind = "libstdc++"; package = gccForLibs; solib = gccForLibs_solib; }
      else if givenLibcxx then
        { kind = "libc++"; lib = libcxx; }
        { kind = "libc++"; package = libcxx;  solib = libcxx_solib;}
      else
      # We're probably using the `libstdc++` that came with our `gcc`.
      # TODO: this is maybe not always correct?
      # TODO: what happens when `nativeTools = true`?
        { kind = "libstdc++"; lib = cc_solib; }
        { kind = "libstdc++"; package = cc; solib = cc_solib; }
    ;

    emacsBufferSetup = pkgs: ''
@@ -590,7 +593,7 @@ stdenv.mkDerivation {
      echo "$ccLDFlags" >> $out/nix-support/cc-ldflags
      echo "$ccCFlags" >> $out/nix-support/cc-cflags
    '' + optionalString (targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false)) ''
      echo " -L${lib.getLib libcxx}/lib" >> $out/nix-support/cc-ldflags
      echo " -L${libcxx_solib}" >> $out/nix-support/cc-ldflags
    ''

    ##
+1 −1
Original line number Diff line number Diff line
@@ -45,6 +45,6 @@ in

# We should use libstdc++ at least as new as nixpkgs' stdenv's one.
assert ((stdenv.cc.cxxStdlib.kind or null) == "libstdc++")
  -> lib.versionAtLeast cxxStdlib.version stdenv.cc.cxxStdlib.lib.version;
  -> lib.versionAtLeast cxxStdlib.version stdenv.cc.cxxStdlib.package.version;

lib.extendDerivation assertCondition passthruExtra cudaStdenv