2

Suppose I have the source for some program, the source uses GNU autotools, and to keep it simple, let's say the program is in no way a development tool of any kind. If I have a cross-toolchain handy, I can configure to cross-compile for the platform fooproc-barvendor-bazos using the --host option:

./configure --host=fooproc-barvendor-bazos

However, in the quiet(er) style of output adopted by various source builds including Linux 2.6,

HOSTCC foo.c

means that foo.c is being built with a native compiler for system I'm building on, to differentiate from

CC bar.c

which means that bar.c is being build with the cross compiler for the system I'm building the program for.

Did I get confused somewhere there, or does the 'host' in HOSTCC just not mean host in the sense of ./configure --host?

rakslice
  • 8,742
  • 4
  • 53
  • 57
  • Looking around a bit more, it seems that BUILD_CC / CC_FOR_BUILD is a common alternative to HOSTCC for specifying the native compiler. – rakslice Jan 05 '12 at 08:26

2 Answers2

5

autoconf/automake do not really have a notion of host compiler. $CC is always the target compiler. If you ever see $HOSTCC, it is a manual addition by the developer of the package you are looking at.

--host specifies on what host type the produced program is intended to be run on.

pevik
  • 4,523
  • 3
  • 33
  • 44
jørgensen
  • 10,149
  • 2
  • 20
  • 27
  • By "target compiler" do you mean the cross compiler for the platform specified to the configure script by --host, and by "host compiler" do you mean the native compiler? – rakslice Jan 05 '12 at 08:25
  • 3
    Yep. HOSTCC/NATIVECC, if it existed, would be influenced by ./configure **--build=xyz** instead (not --host). – jørgensen Jan 05 '12 at 08:55
3

In autoconf the terminology is:

  • build is the system on which you are compiling.
  • host is the system on which what you are building will run.
  • target is what the compiler you are building will compile for, and is irrelevant when not building a compiler.

In other tools, for example ptxdist, the terminology is however:

  • host is the system you are building on.
  • target is the system on which what you are building will run.

So depending on what tool you have, host means different things.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172