--host versus --target
Wed Nov 16 20:18:00 GMT 2011
On Wed, Nov 16, 2011 at 1:12 PM, Yann E. MORIN
>> I'm assuming, however, to use option 1 I would need to specify the
>> toolchain's sysroot directory as the --prefix?
> No, you want to set prefix to the _runtime_ prefix, probably / or /usr or
> /usr/local. And you want to use: make DESTDIR=/path/to/staging install.
Thank you, now I understand.
I had been under the mistaken assumption that the cross-compiler would
perform its #include search with the host system's /usr/include
(etc...) by default (just like my system's native compiler). If that
were the case I would have to somehow tell the compiler to change its
behaviour, which I guessed could be done via ./configure's --prefix
option. But by playing with the cross-compiler's "-v" option I can see
that it instead looks in all the proper locations for the
cross-toolchain's #include files without considering the host system's
#include "..." search starts here:
#include <...> search starts here:
<ct-ng install path>/lib/gcc/i686-nptl-linux-gnu/4.5.2/include
<ct-ng install path>/lib/gcc/i686-nptl-linux-gnu/4.5.2/include-fixed
<ct-ng install path>/lib/gcc/i686-nptl-linux-gnu/4.5.2/../../../../i686-nptl-linux-gnu/include
<ct-ng install path>/i686-nptl-linux-gnu/sysroot/usr/include
This is good news because it means I don't have to do anything
explicitly (although its implicit nature confused me) other than to
inform the compiler of the location of any staging directories. It
also means that both the compiles which take place as part of the
./configure as well as the compiles which are done as part of the
build itself (and any compiles that sometimes occur during an
install!) will behave correctly.
Just out of curiosity, why is the cross-compiler behaving this way
(i.e. why isn't it searching for #includes in the system's
/usr/include directory)? Is it because it is a cross-compiler, or
because it is a sysroot'ed cross-compiler, or because it is performing
a cross-compile? I noticed, while looking through the "-v" output that
someone is including a --sysroot option implicitly.
Thank you for the detailed explanation of how to work each option (in
addition to listing the options previously).
> Solution two would mean:
> cp -a $(tuple-gcc --your-cflags-except-sysroot -print-sysroot) \
> ./configure --blabla-as-above \
> CC="tuple-gcc --syroot=/path/to/staging" \
> CXX="tuple-g++ --sysroot=/path/to/staging" \
> LD="tuple-ld --sysroot=/path/to/staging" \
> AND_SO_ON=tuple-andsoon --sysroot=/path/to/staging"
Very nice, I like this trick (of including the --sysroot as part of
the tool command)! It would save me from caring whether the build
system that comes with the software package handles
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc