-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
clang -std=c++11 does not find C++ headers #256360
Comments
Still not sure whether or not this is working as intended, but it seems that explicitly passing something like It still doesn't solve the issue with Bazel's auto-configured toolchain, since it would not recognise the |
Solved by adding the following line to my
Not sure why this is required by the flavour of Anyway, since I'm not sure whether this is a bug or working as intended, I'll keep it open, but since my problem is now solved, feel free to close this if this is expected behaviour. |
You're supposed to compile c++ files with
nixpkgs/pkgs/test/cc-wrapper/default.nix Line 30 in 0a36180
so it should be working as intended EDIT: I see that you've already tried that but that should be a bazel bug because every other build system uses the compilers correctly. Same issue #150655 |
Ah sorry I didn't find #150655. Let me close this one as duplicate then. I'm not sure I agree with the fact that this is a Bazel bug, since arguably Bazel uses the compilers "correctly", except it doesn't use the provided wrappers that automatically add the C++ header files, which is ultimately down to flexibility since one might want to use a different standard library (or ship their own). But that's besides the point. Eventually I got things to compile using Clang $CC with the right C++ flags though, but I can't find the right incarnation now. I'll close this bug and update it if I find the right set of commands. |
Describe the bug
Given an example
hello_world.cc
file like this:clang
fails to compile it with the command:The
clang
installed by the underlying system (Arch) has no trouble compiling this file.And yes, there is
clang++
for C++ files, but Bazel only invokesclang
(orCC
for that matter), and running Bazel withCC=clang
seems to fail whenever it encounters a C++ compilation unit that uses the standard library, which is pretty much all of them.Steps To Reproduce
hello_world.cc
from above.clang -std=c++11 -c hello_world.cc
Expected behavior
There should be no errors and a 0 exit status, with a
hello_world.o
file generated.Additional context
I have Arch linux as my base system which runs the Nix systemd service, with
clang
installed viahome-manager
.Notify maintainers
Metadata
The text was updated successfully, but these errors were encountered: