Cross-compiling gcc? (sysroot confusion)

Pierre Ossman
Fri Nov 7 10:43:00 GMT 2014

On Wed, 5 Nov 2014 15:35:16 +0100
Pierre Ossman <> wrote:

> > 
> > 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=/ 
> My plan is that that final gcc will be run as /usr/bin/gcc after all
> of /sysroot has been moved to a separate machine, yes.
> So it sounds like --with-build-sysroot is what I need. Thanks.

Unfortunately this isn't working. The problem is that it tries to test
execute programs. Which of course fails as it won't find ld-linux.

gcc's main configure seems to think it is cross compiling as is quite
content with things:

> configure:4415: checking whether the C compiler works
> configure:4424: ./a.out
> ../configure: ./a.out: /lib/ bad ELF interpreter: No such file or directory
> configure:4428: $? = 126
> configure:4443: result: yes
> configure:4450: checking whether we are cross compiling
> configure:4452: result: yes

But the configure in the sub-directories are not playing nice:

> configure:2679: checking whether the C compiler works
> configure:2688: ./a.out
> /home/cendio/cenbuild.git/repo/rpmbuild/BUILD/gcc-4.5.4/libdecnumber/configure: ./a.out: /lib/ bad ELF interpreter: No such file or directory
> configure:2692: $? = 126
> configure:2699: error: in `/home/cendio/cenbuild.git/repo/rpmbuild/BUILD/gcc-4.5.4/build/libdecnumber':
> configure:2703: error: cannot run C compiled programs.
> If you meant to cross compile, use `--host'.
> See `config.log' for more details.

This is from libdecnumber.

My full configure line:

> ../configure --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-build-sysroot=/opt/cendio-build/arch/i386 --with-sysroot=/ --disable-nls --disable-multilib --enable-shared --enable-threads=posix --enable-languages=c,c++


Pierre Ossman           Software Development
Cendio AB
Teknikringen 8
583 30 Linköping
Phone: +46-13-214600

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <>

More information about the Gcc-help mailing list