2010-09-21

Configure with --host, --target and --build options

When people configure a project like './configure', man often meets these three confusing options, which are more related with cross-compilation

  • --host: In which system the generated program will run.
  • --build: In which system the program will be built.
  • --target: this option is only used to build a cross-compiling toolchain. When the tool chain generates executable program, in which target system the program will run.
An example of tslib (a mouse driver library)
'./configure --host=arm-linux --build=i686-pc-linux-gnu': the dynamically library is built on a x86 linux computer but will be used for a embedded arm linux system.

An example of gcc:
'./configure --target=i686-pc-linux-gnu --host=arm-linux --build=i686-pc-linux-gnu':
  • A gcc compiler is build on x86 linux computer. [--build]
  • The gcc will be executed on an embedded arm linux system.[--host]
  • But the gcc will generate the binary program, which run in a x86 linux system. [--target]

Reference:
http://matrix.wearlab.de/en/wiki/index.php?title=ArmCrossCompiler&redirect=no

4 comments:

  1. i can not understand the target is the binary for the arm or x86

    ReplyDelete
  2. If I want to get a gcc, for example run "./configure --build=powerpc --host=i686 --target=mips ", Is the output executable crippled? usually, gcc is a powerful tool that can build c code, then output many kind of result for many platform. Here if I use '--target=mips', does the specified gcc lost the ability? the gcc can only output mips flavor executable?

    ReplyDelete
  3. Thanks for the explanation. This is very helpful for cross-compiling of libraries/tools into other architectures.

    ReplyDelete
  4. I was surfing net and fortunately came across this site and found very interesting stuff here. Its really fun to read. I enjoyed a lot. Thanks for sharing this wonderful information.Target Laptop

    ReplyDelete