When you specify --host=<host-type>
, and this value differs from the result of running the config.guess
script, autoconf
enters cross-compilation mode. Specifically, the variable cross_compiling
is set to yes
.
If the configure script is in 'cross-compilation' mode, it can't run any resulting executable, so there's no way to tell if a resulting binary is a valid 'host' binary or not. Presumably, a large database of file magic values might be able to tell if a valid host binary has been generated. Despite a couple of decades worth of experience built into the autotools, there are some combinatorial problems that can never keep up with all possible architectures and ABIs.
The autoconf
C compiler tests check to see if the compiler - that is $CC
- can build an executable. autoconf
may provide a warning if the compiler is not prefixed with the host triplet, e.g., arm-none-eabi-gcc
, but will not 'fail' if it finds a working compiler, such as the native gcc
.
So, the only way to ensure cross-compilation with the correct compiler is to specify the compiler:
./configure --host=arm-none-eabi CC="arm-none-eabi-gcc"
If this compiler can't build executables, the configure script will fail.