Search code examples
ccross-compilingautotoolsautoconf

Autoconf x86 cross-compiling


AutoConf has --host option to specify an architecture the file will be run on. But if I specify --host=i686-linux-gnu, no option -m32 is added to gcc compiler. What did I understand wrong about AutoConf? Because in this case, if I compile my program on 64 bit machine, it won't run on host machine.


Solution

  • Passing --host=i686-linux-gnu will cause autoconf to look for and use i686-linux-gnu-gcc, etc. rather than gcc. This is expected to be a cross toolchain that produces 32-bit binaries. If you don't want to use a cross toolchain but just -m32, you should just pass CC="gcc -m32" (and CXX="g++ -m32" if the program uses C++) to configure.