[cfe-dev] Clang 3.4 --with-gcc-toolchain question

Jonathan Roelofs jonathan at codesourcery.com
Thu May 8 12:17:57 PDT 2014


David,

On my machine, gcc 4.7 is installed in /usr/local/tools/gcc-4.7.3

I configure from a build directory:
$ mkdir build && cd build
$ ../llvm/configure --with-gcc-toolchain=/usr/local/tools/gcc-4.7.3 --with-extra-ld-options=-Wl,-rpath,/usr/local/tools/gcc-4.7.3/lib/ --enable-optimized

On 5/8/14, 5:56 AM, DbdM Tbt wrote:
> Good day,
> I would like to ask about the behavior of '--with-gcc-toolchain' configuration option.
> I am currently trying out clang 3.4 with gcc 4.7 and for this, I used the centos devtools repo.
> GCC 4.7 is installed into /opt/centos/devtoolset-1.0/.
> I configured clang 3.4 like below:
> CC=/opt/centos/devtoolset-1.0/root/usr/bin/gcc CXX=/opt/centos/devtoolset-1.0/root/usr/bin/g++ <configure> --with-gcc-toolchain=/opt/centos/devtoolset-1.0/root/usr/
>
> Make is ok but when I try clang-check it doesn't seem to find 'iostream'.
> I thought with the option --with-gcc-toolchain, clang and its tools will automatically be pointed the gcc 4.7 directories.
> Perhaps I am missing something here or my assumptions are flawed. Can someone share some insights?.
>
> Using the -v option on clang-check, the "Selected GCC installation:" is blank and the list of include directories don't include the 4.7 directories.
The GCCInsatllationDetector in clang/lib/Driver/ToolChains.h looks for crtbegin.o files in places like:
/usr/local/tools/gcc-4.7.3/lib/gcc/<triple>/<major.minor.patch>/crtbegin.o

In my case, that is:
/usr/local/tools/gcc-4.7.3/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/crtbegin.o

But there are a bunch of formats for this kind of stuff. See Generic_GCC::GCCInstallationDetector::init in clang/lib/Driver/ToolChains.cpp (and the things that it calls).

Cheers,
Jon
> Explicitly specifying the include directories (-I option) in the clang-check invocation will work but is there another workaround?
> I would prefer to resolve such issues in the 'environment setup' aspect and not during 'application usage'.
>
> Thank you very much,
> David
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140508/55529337/attachment.html>


More information about the cfe-dev mailing list