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

ccacheStdenv cannot find libcxx on Darwin #34817

Open
mnacamura opened this issue Feb 10, 2018 · 8 comments
Open

ccacheStdenv cannot find libcxx on Darwin #34817

mnacamura opened this issue Feb 10, 2018 · 8 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin

Comments

@mnacamura
Copy link
Contributor

mnacamura commented Feb 10, 2018

Issue description

The title says it all. I ran this on Darwin:

#!/usr/bin/env nix-shell --pure

with import <nixpkgs> {};
let
  myCcacheWrapper = ccacheWrapper.override {
    extraConfig = ''
      export CCACHE_COMPRESS=1
      export CCACHE_DIR=/var/cache/ccache
      export CCACHE_UMASK=007
    '';
  };
  myStdenv = overrideCC stdenv myCcacheWrapper;
in
myStdenv.mkDerivation {
  name = "darwin-ccacheStdenv-test";
  buildInputs = [ libcxx ];
  shellHook = ''
    cat << CODE > test.cc
    #include <string>
    CODE
    $CXX -c test.cc
    exit 0
  '';
}

It succeeded. Then, I removed libcxx from buildInputs and ran it again. I saw

test.cc:1:10: fatal error: 'string' file not found
#include <string>
         ^~~~~~~~
1 error generated.

Technical details

  • system: "x86_64-darwin"
  • host os: Darwin 17.5.0, macOS 10.13.4
  • multi-user?: no
  • sandbox: no
  • version: nix-env (Nix) 2.0pre5889_c287d731
  • channels(mnacamura): "darwin, nixpkgs-18.03pre127302.e860b651d6e"
  • nixpkgs: /Users/mnacamura/Repos/nixpkgs
@mnacamura
Copy link
Contributor Author

mnacamura commented Feb 11, 2018

Running this

#!/usr/bin/env nix-shell --pure
with import <nixpkgs> {};
stdenv.mkDerivation {
  name = "darwin-stdenv-test";
  shellHook = ''
    cat << CODE > test.cc
    #include <string>
    CODE
    echo NIX_CFLAGS_COMPILE: $NIX_CFLAGS_COMPILE
    echo NIX_LDFLAGS: $NIX_LDFLAGS
    echo NIX_CXXSTDLIB_COMPILE: $NIX_CXXSTDLIB_COMPILE
    echo NIX_CXXSTDLIB_LINK: $NIX_CXXSTDLIB_LINK
    $CXX -c test.cc
    exit 0
  '';
}

returns

NIX_CFLAGS_COMPILE: -isystem /nix/store/yd3bi1p0b7wwd0cgjwy77wh549dm5x3d-libc++-4.0.1/include -F/nix/store/69yzhzc71jhxpjg5gzddj6ifvph3fxp5-CF-osx-10.10.5/Library/Frameworks -isystem /nix/store/yd3bi1p0b7wwd0cgjwy77wh549dm5x3d-libc++-4.0.1/include -F/nix/store/69yzhzc71jhxpjg5gzddj6ifvph3fxp5-CF-osx-10.10.5/Library/Frameworks
NIX_LDFLAGS: -L/nix/store/yd3bi1p0b7wwd0cgjwy77wh549dm5x3d-libc++-4.0.1/lib -L/nix/store/yd3bi1p0b7wwd0cgjwy77wh549dm5x3d-libc++-4.0.1/lib
NIX_CXXSTDLIB_COMPILE: -isystem /nix/store/yd3bi1p0b7wwd0cgjwy77wh549dm5x3d-libc++-4.0.1/include/c++/v1
NIX_CXXSTDLIB_LINK: -stdlib=libc++

and running this

#!/usr/bin/env nix-shell --pure
with import <nixpkgs> {};
let
  myCcacheWrapper = ccacheWrapper.override {
    extraConfig = ''
      export CCACHE_COMPRESS=1
      export CCACHE_DIR=/var/cache/ccache
      export CCACHE_UMASK=007
    '';
  };
  myStdenv = overrideCC stdenv myCcacheWrapper;
in
myStdenv.mkDerivation {
  name = "darwin-ccacheStdenv-test";
  shellHook = ''
    cat << CODE > test.cc
    #include <string>
    CODE
    echo NIX_CFLAGS_COMPILE: $NIX_CFLAGS_COMPILE
    echo NIX_LDFLAGS: $NIX_LDFLAGS
    echo NIX_CXXSTDLIB_COMPILE: $NIX_CXXSTDLIB_COMPILE
    echo NIX_CXXSTDLIB_LINK: $NIX_CXXSTDLIB_LINK
    $CXX -c test.cc
    exit 0
  '';
}

returns

NIX_CFLAGS_COMPILE: -F/nix/store/69yzhzc71jhxpjg5gzddj6ifvph3fxp5-CF-osx-10.10.5/Library/Frameworks -F/nix/store/69yzhzc71jhxpjg5gzddj6ifvph3fxp5-CF-osx-10.10.5/Library/Frameworks
NIX_LDFLAGS:
NIX_CXXSTDLIB_COMPILE:
NIX_CXXSTDLIB_LINK:
test.cc:1:10: fatal error: 'string' file not found
#include <string>
         ^~~~~~~~
1 error generated.

@FRidh FRidh added the 6.topic: darwin Running or building packages on Darwin label Feb 11, 2018
@matthewbauer
Copy link
Member

Yes, I think ccacheWrapper is broken right now...

@matthewbauer matthewbauer modified the milestones: 19.09, 19.03 Jan 26, 2019
@matthewbauer matthewbauer self-assigned this Jan 26, 2019
@matthewbauer matthewbauer modified the milestones: 19.03, 19.09 Jan 26, 2019
@matthewbauer matthewbauer removed their assignment Jan 26, 2019
@luzpaz
Copy link
Contributor

luzpaz commented Apr 12, 2019

can you recreate this on ccache 3.6 ?

@veprbl
Copy link
Member

veprbl commented Nov 20, 2019

caccheStdenv was not tested on Darwin (nor with clang on Linux), so probably it never worked with them

ccacheStdenv used to work for me on darwin a few years ago.

@veprbl veprbl modified the milestones: 19.09, 20.03 Nov 20, 2019
@disassembler disassembler modified the milestones: 20.03, 20.09 Feb 5, 2020
@stale

This comment has been minimized.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 4, 2020
@matthewbauer
Copy link
Member

Still important

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 18, 2020
@FRidh FRidh modified the milestones: 20.09, 21.03 Dec 20, 2020
@stale
Copy link

stale bot commented Jun 18, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 18, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/tensorflow-on-20-09-mac/11931/5

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 1, 2021
@veprbl veprbl removed this from the 21.05 milestone Nov 26, 2021
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests

8 participants
@matthewbauer @mnacamura @veprbl @disassembler @FRidh @luzpaz @nixos-discourse and others