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

llvmPackages_39.stdenv cannot find libstdc++ #29204

Closed
edolstra opened this issue Sep 10, 2017 · 4 comments · Fixed by #29246
Closed

llvmPackages_39.stdenv cannot find libstdc++ #29204

edolstra opened this issue Sep 10, 2017 · 4 comments · Fixed by #29246
Assignees
Labels
0.kind: bug 0.kind: regression Something that worked before working no longer 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Milestone

Comments

@edolstra
Copy link
Member

Issue description

In Nixpkgs 17.09, clang++ 3.9 cannot find libstdc++ headers:

$ nix-build -E 'with import <nixpkgs> {}; llvmPackages_39.stdenv.mkDerivation { name = "foo"; buildCommand = "echo \"#include <vector>\" > foo.cc; clang++ -c foo.cc -o $out"; }' -I nixpkgs=channel:nixos-17.09
these derivations will be built:
  /nix/store/m6cngdi7krryn25cm7bvgildpkjmi7bv-foo.drv
building path(s) '/nix/store/9c9dpbpdbkvpn1m8f6pgqzpygsxacw2j-foo'
building '/nix/store/m6cngdi7krryn25cm7bvgildpkjmi7bv-foo.drv'...
foo.cc:1:10: fatal error: 'vector' file not found
#include <vector>
         ^
1 error generated.
builder for '/nix/store/m6cngdi7krryn25cm7bvgildpkjmi7bv-foo.drv' failed with exit code 1
error: build of '/nix/store/m6cngdi7krryn25cm7bvgildpkjmi7bv-foo.drv' failed

This does work correctly with Clang 4.0 in 17.09, or Clang 3.9 in 17.03.

Setting NIX_DEBUG=1 shows that the cc-wrapper is not adding the appropriate -B flags pointing to libstdc++ in gcc.

Steps to reproduce

See above.

Technical details

  • System: NixOS 17.03
  • Nix version: 1.12pre
  • Nixpkgs version: 17.09beta285.b50193f0ca
  • Sandboxing enabled: no
@aristidb
Copy link
Contributor

aristidb commented Sep 10, 2017

According to git-bisect, one of the following commits is causing the issue (all by @Ericson2314):

commit 2493454e13c25ff990d06deb38b1024e4a0a99f8 (refs/bisect/bad)
Author: John Ericson <John.Ericson@Obsidian.Systems>
Date:   Thu Aug 3 15:34:23 2017 -0400

    cc-wrapper: Use `set -u` throughout
    
    Now is an opportune time to do this, as the infixSalt conversion in
    `add-flags.sh` ensures that all the relevant `NIX_*` vars will be
    defined even if empty.

commit a8bd415fa06a100b29297db86aadb6f00da70bbf (refs/bisect/skip-a8bd415fa06a100b29297db86aadb6f00da70bbf)
Author: John Ericson <John.Ericson@Obsidian.Systems>
Date:   Thu Aug 3 11:29:15 2017 -0400

    unzip: cc-wrapper has been fixed so don't need to be so clever

commit 42f35503b56e293759685e9fb2a66ba75a55c339 (refs/bisect/skip-42f35503b56e293759685e9fb2a66ba75a55c339)
Author: John Ericson <John.Ericson@Obsidian.Systems>
Date:   Thu Jul 6 17:19:53 2017 -0400

    cc-wrapper: Make hygienic
    
    See the added comments for what exactly has been done.

commit 9f1e009975dc2d58541de435c74a26afe011542a (refs/bisect/skip-9f1e009975dc2d58541de435c74a26afe011542a)
Author: John Ericson <John.Ericson@Obsidian.Systems>
Date:   Mon Jun 26 00:43:06 2017 -0400

    cc-wrapper: Unconditionally use @infixSalt@ accross the board
    
    This is basically a sed job, in preparation of the next commit. The
    rules are more or less:
    
      - s"NIX_(.._WRAPPER_)?([a-zA-Z0-9@]*)"NIX_\1@infixSalt@_\2"g
    
      - except for non-cc-wrapper-specific vars like `NIX_DEBUG`

commit 5ba3972addac3dd56518da294d088c92a6fb9798 (refs/bisect/skip-5ba3972addac3dd56518da294d088c92a6fb9798)
Author: John Ericson <John.Ericson@Obsidian.Systems>
Date:   Mon Jun 26 00:43:06 2017 -0400

    cc-wrapper: Stop preWrapping
    
    This is an ugly temp hack for cross compilation, but now we have something better on the way.
    
    Bind `infixSalt` as an environment variable as it will be used in it.

@Ericson2314
Copy link
Member

Ericson2314 commented Sep 10, 2017

Hmm, #28998 was supposed to have fixed this, but I guess only fixed 4.0. @LnL7 any idea?

@LnL7
Copy link
Member

LnL7 commented Sep 10, 2017

Really thought I already applied those changes to the other versions, must have forgotten to push or something.

@LnL7 LnL7 added this to the 17.09 milestone Sep 10, 2017
@Ericson2314
Copy link
Member

Ah I see now---I should have noticed when reviewing that. While we're at it, maybe we should inject it in cc-wrapper instead of stdenv? This mirrors libcxxClang and keeps stdenvNoCC slimmer.

@LnL7 LnL7 self-assigned this Sep 10, 2017
dtzWill added a commit to dtzWill/nixpkgs that referenced this issue Oct 3, 2017
@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 0.kind: regression Something that worked before working no longer 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants