Can someone point to any detailed information about how these flags
work? I have a custom-compiled version of GCC on Linux and I'm trying
to build Clang 4.0.0 for this system as well. I would like it to use
libstdc++ from my custom-compiled GCC installation to allow linking of
other libraries built with libstdc++.
I also have a sysroot that I use with GCC so it compiles against a known
set of system headers and libraries (based on Red Hat 6.3 in this case).
This sysroot is directly extracted from a Red Hat system (technically,
it's extracted from the RPMs) so the layout is straightforward and using
the --sysroot for GCC locates it without any problems.
However, I can't get clang to work with either of these environments no
matter what options I provide it.
For --sysroot for example, I have this:
If I use "gcc --sysroot=/my/sysroot" all works fine. If I use "clang
--syroot=mysysroot" no system headers are found. I used strace on the
clang binary to try to figure out what it's looking for and it searches
for all of these things in my sysroot directory:
Of these only the four marked exist in my sysroot. But the big thing
here is that at no time does clang look for /my/sysroot/usr/include, and
indeed when the preprocessor tries to find headers it doesn't look
there, and none of my system header files are found!
Do I have to add these myself with -isystem even when I specify
--sysroot and the header directory is right there? Is --sysroot not
intended to be used to locate header files?
For --gcc-toolchain the situation is similar although clang looks in
MANY more places to try to locate the GCC toolchain. However, I build
GCC myself and I have a completely standard installation: what you get
when you run make / make install after a configure --prefix. My GCC
installation looks like:
(I have a GCC 6.2 install too and the layout is basically identical.)
When I use --gcc-toolchain with clang it looks in about 50 different
directories but doesn't seem to be able to locate this: a standard
unmodified installation of GCC. I've tried numerous different values
for --gcc-toolchain but none seem to work.
Am I doing something wrong here? Or is this just not going to work and
I'll have to figure out all the include directories, etc. I need by hand
and add them via -isystem etc. myself?
Thanks for any help you can provide!