[cfe-commits] [PATCH] [Driver] Make default GCC install prefix and sysroot relocatable

Kito Cheng kito at 0xlab.org
Tue Dec 11 10:01:16 PST 2012

>>> Doesn't the clang driver already search for gcc libraries installed next to it?
>> In my experiment, the clang will found the gcc toolchain if
>> GCC_INSTALL_PREFIX is not set even the install folder is relocated,
>> but not work when GCC_INSTALL_PREFIX is set during cross-compilation
>> :(
>> And here is no standard path for place libraries and header for a
>> cross-compilation gcc. so the clang can't find that.
>> The sysroot part is not work fine both on DEFAULT_SYSROOT set or not
>> set during cross-compilation.
> Sorry, not sure I follow. Why doesn't:
> ../gcc/configure --prefix=/toolchain/install/dir --host=..
> --target=... --build=...
> ...
> ../llvm/configure --prefix=/toolchain/install/dir
> produce a relocatable build like you want?

This way I've tried, it's work only the gcc toolchain part (and not
work if configure with --with-gcc-toolchain),
but the sysroot part is not work.

in our build the configure as follow

 ../llvm/configure --target=arm-none-linux-gnueabi

and the prefix folder contain a pre-build toolchain which is download
from codesourcery.

>>> If you need it to be in a subfolder or something, I would prefer to add support for GCC_INSTALL_PREFIX being a relative path, so that you can build with something like
>>> configure --with-gcc-toolchain=../relative/gcc/install/dir/
>>> instead of doing prefix match at runtime.
>> Configure with the relative path I think it's not instinct enough,
>> which ones upper folder, clang or install path?
>> Here is almost no run-time overhead if GCC_INSTALL_PREFIX and
>> DEFAULT_SYSROOT is not set.
> The problem is not so much the overhead, is the code doing something
> different depending on GCC_INSTALL_PREFIX overlapping or not with the
> install directory.
> what about something like
> --with-gcc-toolchain='$prefix/../relative/gcc/dir'? $prefix would then
> be replaced at runtime with where clang is installed. Without $prefix
> an absolute path is still assumed.

I don't like it but acceptable :|
Would you have interest merge it with the $prefix version?
The sysroot relocatable is important for us since we are building a
cross-compilation toolchain distribution with both gcc and clang.

> Cheers,
> Rafael

More information about the cfe-commits mailing list