LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GCC : Clarity on difference between Build , Host and Target. (https://www.linuxquestions.org/questions/programming-9/gcc-clarity-on-difference-between-build-host-and-target-849125/)

theKbStockpiler 12-08-2010 03:04 PM

GCC : Clarity on difference between Build , Host and Target.
 
I doubt I understand the context at all but here is an example from this web page. http://gcc.gnu.org/onlinedocs/gccint...onfigure-Terms
Quote:

There are three system names that the build knows about: the machine you are building on (build), the machine that you are building for (host), and the machine that GCC will produce code for (target). When you configure GCC, you specify these with --build=, --host=, and --target=.
So the nonsensical question that this conjures is ," obviously I would want this code to run on the system that I'm compiling it for so what does TARGET mean? What is the difference between host and target?

Thanks in advance!

ozanbaba 12-08-2010 03:45 PM

Crosscompiling:
A example from my system:
Host: x86_64-slackware-linux
Target: i686-mingw32-windows

Compiling FOR i686 windows system (TARGET) ON Slackware 64 bit (Host).

Here's a extream example:
build: i484-slackware-linux; I'm compiling on a old Slackware system
host: arm-slackware-linux; To run on ArmedSlack (ARM CPU)
target: i686-mingw32-windows; Compiling for Win32 system

Cross-compiling is pretty common thing to do and it is done in a lot of systems. Instead of using limited resources of a small system (Like your phone), They compile the code on their computers to run on the phone.

theKbStockpiler 12-09-2010 12:23 AM

Catch 22 of no installed compiler and no binary available.
 
I want to point out to anyone that is interested in this topic and can't find an explanation of the Relationships between Build , Host , Target or which each is defined by it's self. I found an explanation here http://books.google.com/books?id=wQ6...20host&f=false The mystery is caused by having a computer that does not have a compiler and a binary file to install one is not available. Hence you have to have what I would term a "Host" computer to compile the compiler for the computer that is absent a compiler. The compiled source code in a binary form would than be transferred to the compiler-less computer.


"Build" is the computer that compiles a compiler for another computer.

"Host" is the Computer that compiles the wanted application using the compiler that was compiled for it.

"Target" is the computer that the application (not the compiler) will execute on.

That's the best I could do. If any corrections are warranted please feel free to add a post.

theNbomr 12-10-2010 10:27 AM

There is no rigorous definition; these terms are used by convention within the compiler & toolchain builder community. Within that community, there is interest in creating tools that target and run on various combinations of hosts and host types. Most developers are accustomed to using compilers that are native to the target architecture: we build applications on the target architecture itself. However, it is also possible to build application binaries which are intended to run on other architectures. This we call cross-compiling, or more accurately, cross-building.
The matter is even deeper, however. Consider that someone has to build the cross-compiler that generates the binaries. Here, the jargonology becomes significant. For instance, one may wish to create a cross compiler that runs on a x86 host, but creates binaries for a PowerPC target. In this case, the 'host' is the X86 host, and the 'target' is the PowerPC. When the cross-compiler that runs on the x86 host was built, it was done on a 'build' host, which was potentially a third, completely different architecture than the 'host' or 'target' architectures.

For a view of the issues related to this subject, you could review the archives of the crosstool-ng mailing list.

--- rod.


All times are GMT -5. The time now is 09:53 PM.