[cfe-dev] Changing the way Clang's driver computes the library search paths on Linux
csdavec at swan.ac.uk
Sun Oct 2 11:44:14 PDT 2011
On 2 Oct 2011, at 19:09, Chandler Carruth wrote:
>> On Sun, Oct 2, 2011 at 11:05 AM, David Chisnall <csdavec at swan.ac.uk> wrote:
>> It is, at least, no more broken than it was before. However, there still appears to be no way of specifying the location of crt*.o, and since reverting my patch it no longer respects -B, so cross-compilation toolchains that target Linux are back in the not-working category.
> If you have a system root with a '/lib/crt*.o' (or a /usr/lib/crt*.o) in it, then I believe --sysroot will work. If it doesn't I will fix it until it does. That's because this is the cross-compiling environment I'm working with. I'm not sure its there yet, but I do plan to make sysroot work.
> Why sysroot rather than -B? Because sysroot seems much more principled in its behavior, and because the previous toolchain I was working with heavily was a GCC one that used sysroot heavily. It's only use of -B was to locate auxillary *binaries* to run during the build, which I believe Clang supports.
The Palm PDK, that I am working with, provides a sysroot environment, but it only include platform libraries, not compiler libraries. The crt*.o files are installed in /opt/PalmPDK/arm-gcc/lib/gcc/arm-none-linux-gnueabi/4.3.3/, while the sysroot is /opt/PalmPDK/arm-gcc/sysroot.
-sysroot and -B must therefore both be used. The former to provide the location of the sysroot, the latter twice, to provide the location of the different parts of the GNU toolchain (the assembler / linker in /opt/PalmPDK/arm-gcc/bin and crt*.o in /opt/PalmPDK/arm-gcc/lib/gcc/arm-none-linux-gnueabi/4.3.3/).
Since clang does not accept multiple --sysroot arguments, I can't use --sysroot for this.
> I'm still happy for you to propose patches using -B, but they need to not break existing use cases.
It would help if you told me WHAT didn't work with my last patch. I added = to the start of a couple of paths. If -B is not specified, then this should have no effect. If -B is specified and the searched-for files do not exist in that location, then it should still have no effect...
More information about the cfe-dev