2017-06-13 16:09 GMT+02:00 Paul Smith <p...@mad-scientist.net>: > 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.
Well, IIRC that's actually how the toolchain support in clang is handled. You can grep for "crtbegin.o" if you want to recheck. I know it's not what one expects from this flag, but I didn't wrote that code, so don't shoot the messenger :) > 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. If you run this command it will show that it will check for crtbegin.o in the sysroot at some point. Maybe in your scenario it's just failing earlier at some other file; or it's maybe something completely different, but usually my personal --sysroot failures are due to the crtbegin.o not being there. $ strace -f clang++ -fsyntax-only --sysroot /./ /dev/null -v 2>&1 | grep "/./" | grep crtbegin.o > 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...? Well, I think the clang test suite is as said a better starting point to see what clang expects from a sysroot, but for the reference, this is how my working sysroot subtree of lib looks like: https://pastebin.com/raw/UZ5GVFUe (This tree was created by a tool, so I don't know the reason for exactly those dirs/files being there). - Raphael _______________________________________________ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users