[cfe-dev] Issues with C++ stdlib include paths and Clang compilation.

Justin Bogner via cfe-dev cfe-dev at lists.llvm.org
Thu Dec 10 12:59:58 PST 2015

Looks to me like we missed updating the name of the flag when the
get_started page switched from configure to cmake. I've fixed it to say

The flag probably deserves documentation on the CMake page as well.
Would you be up to providing a patch? The file to look for is
docs/CMake.rst in the llvm repo.

Rocco Moretti via cfe-dev <cfe-dev at lists.llvm.org> writes:
> Thanks. Adding "-DGCC_INSTALL_PREFIX=/path/to/gcc/5.2.0/" on the cmake
> command line (as opposed to setting the GCC_INSTALL_PREFIX environment
> variable) seems to work.
> Is there a location where this is documented?
> http://clang.llvm.org/get_started.html (the first hit when I Google
> "install clang") still talks about the --with-gcc-toolchain option, and
> http://llvm.org/docs/CMake.html (linked from the previous page as more
> details about cmake and first hit when I search "clang cmake") doesn't
> mention it as a relevant option for the CMake build.
> On Thu, Dec 10, 2015 at 11:42 AM, don hinton <hintonda at gmail.com> wrote:
>> Try using GCC_INSTALL_PREFIX when you invoke cmake.
>> On Dec 10, 2015 11:34 AM, "Rocco Moretti via cfe-dev" <
>> cfe-dev at lists.llvm.org> wrote:
>>> Hello,
>>> I'm having difficulties compiling the Clang 3.7.0 release. For this I'm
>>> attempting to use gcc 5.2.0 installed in a non-standard location (as the
>>> system compiler is gcc 4.4, and not something I have authorization to
>>> update).
>>> I'm using the --with-gcc-toolchain option to the cmake command to point
>>> to the directory of the gcc 5.2.0 install, and I do get the "The CXX
>>> compiler identification is GNU 5.2.0" messages. (But it does this even when
>>> I omit the --with-gcc-toolchain option, as I've set the CC and CXX
>>> environment variables.)
>>> However, when I attempt to use the compiler, I'm apparently getting the
>>> system gcc 4.4 include search paths for the standard library, rather than
>>> the 5.2.0 paths:
>>> $ bin/clang++ -E -x c++ - -v < /dev/null
>>> ...
>>> #include "..." search starts here:
>>> #include <...> search starts here:
>>>  /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7
>>>  /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/x86_64-redhat-linux
>>>  /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/backward
>>>  /usr/local/include
>>>  /path/to/clang/3.7.0/build2/bin/../lib/clang/3.7.0/include
>>>  /usr/include
>>> End of search list.
>>> ...
>>> Am I correct that my compile was unable to find the gcc 5.2.0 C++
>>> standard library, or am I thinking about this in the wrong fashion?
>>> My Google searching and different compilation attempts haven't been very
>>> successful. The --with-gcc-toolchain option isn't documented all that well,
>>> specifying just that it's "where gcc is installed", but not saying anything
>>> about what, exactly, is expected from that directory (I presume it's the
>>> same as the install prefix passed to the GCC compile; the directory which
>>> contains the bin/ lib/ include/, etc. directories where the gcc version
>>> is), or what will happen if the C++ stdlib is not found in that directory
>>> (is there any error message?).
>>> Thanks.
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list