Skip to content

Clang can't find C++ header files #30670

@abbradar

Description

@abbradar

Issue description

cc-wrapper's add-flags.sh sets NIX+CXXSTDLIB_COMPILE to an empty value. Because of this, fallback in cc-wrapper.sh doesn't work:

        NIX_x86_64_unknown_linux_gnu_CFLAGS_COMPILE+=" ${NIX_x86_64_unknown_linux_gnu_CXXSTDLIB_COMPILE:--isystem /nix/store/rww78vdn2rkayrnqsjl8ib5iq2vfm3sw-gcc-6.4.0/include/c++/6.4.0 -isystem /nix/store/rww78vdn2rkayrnqsjl8ib5iq2vfm3sw-gcc-6.4.0/include/c++/6.4.0/x86_64-unknown-linux-gnu}"

Steps to reproduce

 nixpkgs git:(master) ✗ nix-build -A clang
/nix/store/mwhqir1mj7l9n79amfq0gmwlw9pc6afh-clang-wrapper-4.0.1
 nixpkgs git:(master) ✗ result/bin/clang++ -std=c++11 test.cpp 
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^~~~~~~~~~
1 error generated.

Technical details

  • Nixpkgs version: (run nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion) e458c44

cc @Ericson2314 . I'm unsure how to fix it -- we can use ${foo:-default} substitution for the fallback instead but it will then incorrectly handle empty case (when someone really wants us to not add those flags).

Metadata

Metadata

Assignees

Labels

0.kind: regressionSomething that worked before working no longer6.topic: llvm/clangIssues related to llvmPackages, clangStdenv and related

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions