Cross-compiling:--host--build--target What exactly does that mean?

Source: Internet
Author: User

is always doing cross-compiling, in fact, sometimes the understanding of these three things is not so clear

From the perspective of the cross-tool chain, you can summarize the following

--build= who compiles here. It means that your current compilation action is running somewhere. If you are compiling an arm toolchain, although the toolchain is for ARM, the tool chain is built on the host. So--build=i686-pc-linux-gnu

--host= the current compiled program where to run. So after the tool chain is ready, the compiler program for the target system is all set to the host arm.

--target= for who compiles the program, this in cross-compile time with host a meaning, is generally guess, and the Configure script will say is =--host.

In general, we compile complex cases of cross-compiling, it is said that there is a very complicated situation, three platforms:

Compare, I am now on the i686 machine, want to compile a cross tool chain running on PPC, then this cross tool chain is ARM production program, this is even more complicated.

This is supposed to be the BINUTILS,GCC,LIBC three--be careful about setting it up.

It could be--build=i686-pc-linux-gnu--host=ppc-xxx--target=arm-xxx.

No experiment, you can experiment next day, under the study. Continued: Three platform cross-compilation experiment

Extract the Binutils source code, configured as follows:

.. /binutils-2.21.1/configure--build=i686-pc-linux-gnu--host=armv5l-jztech-linux-gnueabi--target=mips-linux-- Prefix=/home/dbh/workspace/linux-dev/nmru/prjhome/sources/bin-build/dest

Then make, find the compile time most of the time called ARMV5L-XX-GCC, successfully completed,

Make install and install to dest below:

Then LS dest

Bin Lib Mips-linux share

It seems that target is really MIPS, then file:

File Bin/mips-linux-as
Bin/mips-linux-as:elf 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for Gnu/linux 2.6.16, not stripped

Mips-linux-as is a cross compiler oh, running on arm, but Target is MIPS, Haha, it seems a little feeling.

This can be understood, in fact, compile the compile system according to the appropriate host, build to invoke the appropriate GCC to do things, you can see, in three platforms, the--build platform is run compiled script or make, will call host compiler, and it is obvious that The host specified must be a cross compiler.

Http://blog.chinaunix.net/uid-20634420-id-3027812.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.