./configure with --host, --target, --build
Yes it's confusing!
... but many times you need to pass those things in order to get your package to cross compile ...
- --host: The system where built programs and libraries will run.
- --build: The system on which the package is built.
- --target: When building compiler tools: the system for which the tools will create output.
./configure --host=arm-linux --build=i686-pc-linux-gnu
If you specify --host, but not --build, when configure performs the first compiler test it tries to run an executable produced by the compiler. If the execution fails, it enters cross-compilation mode. This is fragile. Moreover, by the time the compiler test is performed, it may be too late to modify the build-system type: other tests may have already been performed. Therefore, whenever you specify --host, be sure to specify --build too.
./configure --target=i686-pc-linux-gnu --host=arm-linux --build=i686-pc-linux-gnu
- gcc will generate the binary program, which run in a x86 linux system. [--target]
- gcc is built on an x86 linux computer. [--build]
- gcc will be executed on an embedded arm linux system.[--host]