Cross-compiling gcc? (sysroot confusion)

Christer Solskogen christer.solskogen@gmail.com
Tue Nov 4 21:30:00 GMT 2014


On 04.11.2014 19:02, Pierre Ossman wrote:
>> A lot of stuff is *not* straight forward to cross compile. Coreutils ,for instance, can be a pain.
>>
>> Whats the confusion? The final-gcc is pretty straight forward :-)
>>
>> I would use something like this:
>>   export PATH=/bootstrap/bin:$PATH
>>     ./configure --target=i686-pc-linux-gnu --prefix=/bootstrap
>>                 --with-gmp=/bootstrap --with-mpfr=... --with-mpc=...
>>                 --with-sysroot=/sysroot
>>                 --enable-__cxa_atexit
>>                 --enable-languages=c,c++
>
> I may be explaining things improperly. The above would give me a gcc
> that cross compiles from the host system to i686-pc-linux-gnu, right?
> Otherwise specifying --with-gmp=/bootstrap seems wrong as that
> directory most likely contains x86_64 binaries.
>

Correct.

You must seperatly install gmp,mpfr and mpc into /sysroot before you try 
to compile gcc using the cross compiler in /bootstrap.
Also, you only need to compile glibc one time.

What you can do is to use the --with-build-sysroot.

Is the whole consept that you are going to copy /sysroot to another 
machine? Is the crossed compiler (the one that was compiled using the 
cross compiler) supposed to use /sysroot on the target machine as 
sysroot?  (Because that is a bit of a hack!)

If not you can do something like this: --with-gmp=/sysroot (you don't 
need to add --with-mpfr and --with-mpc as long as you used --with-gmp) 
--host=i686-pc-linux-gnu --with-build-sysroot=/sysroot --with-sysroot=/

-- 
chs



More information about the Gcc-help mailing list