Discussion:
Crossed native compiler
BERTRAND Joël
2014-10-01 13:22:01 UTC
Permalink
Hello,

I'm trying to build a crossed native gcc 4.9.1 for arm (linux) on a x86
host. Thus, I have tried to configure gcc tree with :

../gcc-4.9.1/configure --target=arm-cortexa9_neon-linux-gnueabihf
--enable-languages=c,c++,fortran --enable-bootstrap
--with-gmp=/home/bertrand/cross --prefix=/home/bertrand/q7
--with-build-sysroot=/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot
--disable-threads --build=x86_64-unknown-linux-gnu
--host=arm-cortexa9_neon-linux-gnueabihf

Build aborts in stage 2 with :

checking for arm-cortexa9_neon-linux-gnueabihf-gcc...
/home/bertrand/cross/build/./prev-gcc/xgcc
-B/home/bertrand/cross/build/./prev-gcc/
-B/home/bertrand/q7/arm-cortexa9_neon-linux-gnueabihf/bin/
--sysroot=/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot

checking for C compiler default output file name...
configure: error: in `/home/bertrand/cross/build/intl':
configure: error: C compiler cannot create executables
See `config.log' for more details.
Makefile:5792: recipe for target 'configure-stage2-intl' failed
make[2]: *** [configure-stage2-intl] Error 77
make[2]: Leaving directory '/home/bertrand/cross/build'
Makefile:19319: recipe for target 'stage2-bubble' failed
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory '/home/bertrand/cross/build'
Makefile:888: recipe for target 'all' failed
make: *** [all] Error 2

In config.log, I have :

configure:3000: /home/bertrand/cross/build/./prev-gcc/xgcc
-B/home/bertrand/cross/build/./prev-gcc/
-B/home/bertrand/q7/arm-cortexa9_neon-linux-gnueabihf/bin/
--sysroot=/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot
-g -O2 -static-libstdc++ -static-libgcc conftest.c >&5
/lib/ld-linux-armhf.so.3: No such file or directory
configure:3004: $? = 255
configure:3041: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3047: error: in `/home/bertrand/cross/build/intl':
configure:3051: error: C compiler cannot create executables
See `config.log' for more details.

I have checked xgcc format and xgcc is built for arm, not for x86 :

schroedinger:[~/cross/build/intl] > file
/home/bertrand/cross/build/./prev-gcc/xgcc
/home/bertrand/cross/build/./prev-gcc/xgcc: ELF 32-bit LSB executable,
ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for
GNU/Linux 2.6.16, not stripped

On https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html, I can read :
"If host and target are the same, but build is different, you are using
a cross-compiler to build a native for a different system."

I suppose I have done a mistake... Any idea to build a crossed native
compiler ?

Best regards,

JKB
Marc Glisse
2014-10-01 15:49:34 UTC
Permalink
Post by BERTRAND Joël
I'm trying to build a crossed native gcc 4.9.1 for arm (linux) on a
../gcc-4.9.1/configure --target=arm-cortexa9_neon-linux-gnueabihf
--enable-languages=c,c++,fortran --enable-bootstrap
--with-gmp=/home/bertrand/cross --prefix=/home/bertrand/q7
--with-build-sysroot=/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot
--disable-threads --build=x86_64-unknown-linux-gnu
--host=arm-cortexa9_neon-linux-gnueabihf
Bootstrapping seems like a strange idea for a cross-compilation. Does it
work better without bootstrap?

You could bootstrap a native x86_64-unknown-linux-gnu and make sure you
use that one for your (non-bootstrap) cross-build.
--
Marc Glisse
BERTRAND Joël
2014-10-01 16:15:25 UTC
Permalink
Post by Marc Glisse
Post by BERTRAND Joël
I'm trying to build a crossed native gcc 4.9.1 for arm (linux) on
../gcc-4.9.1/configure --target=arm-cortexa9_neon-linux-gnueabihf
--enable-languages=c,c++,fortran --enable-bootstrap
--with-gmp=/home/bertrand/cross --prefix=/home/bertrand/q7
--with-build-sysroot=/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot
--disable-threads --build=x86_64-unknown-linux-gnu
--host=arm-cortexa9_neon-linux-gnueabihf
Bootstrapping seems like a strange idea for a cross-compilation. Does it
work better without bootstrap?
You could bootstrap a native x86_64-unknown-linux-gnu and make sure you
use that one for your (non-bootstrap) cross-build.
Thanks for your answer, I will try.

Regards,

JKB
Kai Ruottu
2014-10-01 16:33:10 UTC
Permalink
Post by BERTRAND Joël
configure:3000: /home/bertrand/cross/build/./prev-gcc/xgcc
-B/home/bertrand/cross/build/./prev-gcc/
-B/home/bertrand/q7/arm-cortexa9_neon-linux-gnueabihf/bin/
--sysroot=/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot
-g -O2 -static-libstdc++ -static-libgcc conftest.c >&5
/lib/ld-linux-armhf.so.3: No such file or directory
So what you have in the expected place :

/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot/lib

for the 'ld-linux-armhf.so.3' ?
Post by BERTRAND Joël
schroedinger:[~/cross/build/intl] > file
/home/bertrand/cross/build/./prev-gcc/xgcc
/home/bertrand/cross/build/./prev-gcc/xgcc: ELF 32-bit LSB executable,
ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs),
for GNU/Linux 2.6.16, not stripped
That you managed to run an ARM executable (xgcc) on a x86_64 system and
it then giving a sane error
message, is really, really weird! The '--enable-bootstrap' maybe could
have caused this insanity being
done but then the error should have been related to not being capable to
run ARM executables on a
x86_64 system...
BERTRAND Joël
2014-10-02 09:31:13 UTC
Permalink
Post by Kai Ruottu
Post by BERTRAND Joël
configure:3000: /home/bertrand/cross/build/./prev-gcc/xgcc
-B/home/bertrand/cross/build/./prev-gcc/
-B/home/bertrand/q7/arm-cortexa9_neon-linux-gnueabihf/bin/
--sysroot=/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot
-g -O2 -static-libstdc++ -static-libgcc conftest.c >&5
/lib/ld-linux-armhf.so.3: No such file or directory
/home/bertrand/x-tools/arm-cortexa9_neon-linux-gnueabihf/arm-cortexa9_neon-linux-gnueabihf/sysroot/lib
for the 'ld-linux-armhf.so.3' ?
Post by BERTRAND Joël
schroedinger:[~/cross/build/intl] > file
/home/bertrand/cross/build/./prev-gcc/xgcc
/home/bertrand/cross/build/./prev-gcc/xgcc: ELF 32-bit LSB executable,
ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs),
for GNU/Linux 2.6.16, not stripped
That you managed to run an ARM executable (xgcc) on a x86_64 system and
it then giving a sane error
message, is really, really weird! The '--enable-bootstrap' maybe could
have caused this insanity being
done but then the error should have been related to not being capable to
run ARM executables on a
x86_64 system...
Without bootstrap, gcc builds as expected but I'm unable to compile
gfortran, only C and C++. Thus, I have installed a first crossed native
compiler to build a full featured gcc.

Regards,

JKB

Continue reading on narkive:
Loading...