clang++ doesn't even compile a hello world program : fatal error: 'iostream' file not found Using the -v command line switch shows that it searches /usr/lib/gcc/x86_64-pc-linux-gnu/$VVV/include/g++-v4/x86_64-pc-linux-gnu/ where $VVV goes up to 4.4.3 but I have installed 4.4.4 This is with clang-9999 clang should probably select the headers of the currently selected (gcc-config) gcc version. Reproducible: Always
there is not clang++ on tree
there is no explicit clang++ in the tree, but it forms part of the sys-devel/clang package (though remains somewhat experimental IIRC). I can report the same symptoms as Helmut here using =sys-devel/clang-2.7
Yes, I saw the problem when testing 4.5.0 in 2.7, clang has a set of hardcoded paths for current distributions/compilers (including a few for Gentoo, but of course not the new ones) The workaround for now will be to add the paths to currently installed gcc when merging clang, and log that rebuilding clang may be needed when installing a new gcc I hope next version will have a more dynamic way to look for these...
Ok, clang-2.7-r1 is in tree (and -9999 updated), which finds the current gcc version headers Sadly the path is added at compilation time (for this version) so any gcc version change/update will require a clang remerge. From upstream bug let's hope later versions of clang will find at runtime Thanks for the report!
Hi Folks, I have the same issue and I'm on ~x86. (In reply to comment #4) > Ok, clang-2.7-r1 is in tree (and -9999 updated), which finds the current gcc > version headers > Sadly the path is added at compilation time (for this version) so any gcc > version change/update will require a clang remerge. From upstream bug let's > hope later versions of clang will find at runtime > > Thanks for the report! > Could you please tell me how to add these paths in compilation time?? (I know to set variables in emerge command like: # var="value" emerge sys-devel/clang but which variables you're setting??) This is my gcc search path: #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4 /usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4/i686-pc-linux-gnu /usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4/backward /usr/local/include /usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include /usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include-fixed /usr/include End of search list. Any help will be appreciated.
On my machines, "gcc-config -X" returns: /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4 (for gcc-4.4.4-r1) /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.5/include/g++-v4 (for gcc-4.3.5) So I had to change: CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1)/include/g++-v4" to simply: CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1)" for this to work for me.
(In reply to comment #5) > Could you please tell me how to add these paths in compilation time?? > (I know to set variables in emerge command like: > # var="value" emerge sys-devel/clang > but which variables you're setting??) You shouldn't have to set any variables when merging the new ebuild. I haven't tested on a large application yet, but as mentioned previously simply re-syncing portage, and re-emerging clang let me compile a couple of trivial pieces of code laying about here. Works for me.
Ah !! It works. Thanks! I think I found a solution. http://comments.gmane.org/gmane.comp.compilers.clang.devel/7774 I did this and it's simply works :) cd /usr/portage/distfiles/ tar xvzf llvm-2.7.tgz -C ~/Desktop/ tar xvzf clang-2.7.tgz -C ~/Desktop/llvm-2.7/tools/ cd ~/Desktop/llvm-2.7/ mv tools/clang-2.7/ tools/clang/ nano tools/clang/lib/Frontend/InitHeaderSearch.cpp ######## // Gentoo gcc 4.4.4 AddGnuCPlusPlusIncludePaths( "/usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4", "i686-pc-linux-gnu", "", "", triple); ######## mkdir ./build && cd ./build cmake ../ sudo make install
Thanks for the x86 output of gcc-config, I'll change the cxx-include-root variable to something that should work on all Re #8, yes that is the other way to do it, I find it a bit messier as clang++ will go over a bunch of non-existing directories when looking for headers (the InitHeaderSearch.cpp size gets scary)
While not fully related to the bug. I should note that clang C++ support is best built against llvm-gcc (trunk if possible) Could you please add the following include: /usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1/ I'm not sure what the stable version (of llvm-gcc) uses for inlude. Thanks.
(In reply to comment #10) > While not fully related to the bug. I should note that clang C++ support is > best built against llvm-gcc (trunk if possible) > > Could you please add the following include: > > /usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1/ > > I'm not sure what the stable version (of llvm-gcc) uses for inlude. > > Thanks. > Patched into mainline clang. No longer needed :)
(In reply to comment #11) > (In reply to comment #10) > > While not fully related to the bug. I should note that clang C++ support is > > best built against llvm-gcc (trunk if possible) > > > > Could you please add the following include: > > > > /usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1/ > > > > I'm not sure what the stable version (of llvm-gcc) uses for inlude. > > > > Thanks. > > > > Patched into mainline clang. No longer needed :) > Your patch for finding the current gcc headers ignores that I use llvm-gcc (and do not have gcc installed). It may be worth adding an "llvm-gcc" flag that will use the llvm-gcc headers instaed.
OK, clang-2.7-r2 is in tree now, with a new USE flag, system-cxx-headers. Enabling it will use active gcc headers and should work on both x86 and amd64, disabling it will let clang++ behave as before, searching through its hardcoded paths (which include llvm-gcc in -9999). This should work for everyone :) thanks all
(In reply to comment #13) I tried to build Boost.Thread with clang and it looks like clang can't find #include <cxxabi.h> in file ($BOOST_ROOT)/boost/exception/detail/type_info.hpp:18 After checking on my system, this file is located in /usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include The directory is not present in clang executable.
(In reply to comment #14) Let's open a new bug, this one was about clang not even building "Hello world" C++ program without the system-cxx-headers USE flag