[cfe-users] --sysroot and --gcc-toolchain: any docs etc.?

Paul Smith via cfe-users cfe-users at lists.llvm.org
Tue Jun 13 07:09:32 PDT 2017


On Tue, 2017-06-13 at 15:08 +0200, Raphael Isemann wrote:
> we also had this problem and the thing it that clang checks for a
> valid GCC/libstdc++ installation by looking for the crtbegin.o file in
> the related lib directory. So it doesn't work if you just have the
> headers for libstdc++, you also need to recreate the folder-structure
> that leads to the crtbegin.o file, otherwise clang doesn't recognize
> this as a valid sysroot.

Right at the end this comment seems to conflate the compiler install
with the sysroot, and these are not the same thing.  Maybe it's just a
typo but if clang has that same confusion then maybe that's where my
problem lies: it's important to separate the sysroot (libc, system
headers, etc.) from the compiler (STL, libgcc or equivalent, etc.)
because multiple compilers can use the same sysroot, and the same
compiler can use multiple sysroots.

The crtbegin.o is part of the compiler, not part of the sysroot, so when
I specify a path for --sysroot clang should not be trying to find that
file there.  From my strace logs it doesn't appear that it does look for
crtbegin.o in the sysroot so that's good.  But of course it doesn't
explain why clang never tries to look for my system headers.

The GCC installation is a complete make / make install, it's not a
package installation, and so it definitely contains the entire compiler
installation, including crtbegin.o, not just the headers:

  /my/gcc/lib/gcc/x86_64-generic-linux-gnu/7.1.0/32/crtbegin.o
  /my/gcc/lib/gcc/x86_64-generic-linux-gnu/7.1.0/crtbegin.o

This is the standard location so I'm not sure what folder structure I
should be recreating...?



More information about the cfe-users mailing list