This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1 of 2] docs: --target versus --host


On Thu, Nov 17, 2011 at 2:26 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> config.guess makes a very good job at finding what is the tuple of the
> current machine, which is the build machine. And the guess done by
> config.guess is probably better than the random tuple the developer
> would pass to --build.
>
> Therefore, I would rather state that if the software package uses the
> autotools system, then you should let autotools guess what's the tuple
> of the build system.

That's a good point.

Additionally I have found one tiny corner case where not specifying
the --build option was a good thing.

When using a 64-bit x86 system to generate a rootfs for a 32-bit x86
system, if you specify --build you are telling the ./configure script
you are cross compiling and it will therefore not attempt any tests
which require a running binary. In this case bash-4.2 (for example)
will automatically assume conservative values if you don't tell it
otherwise e.g.:

     checking for printf floating point output in hex notation...
configure: WARNING: cannot check printf if cross compiling --
defaulting to no

whereas if you don't specify --build one of the first things the
./configure script will do is to check if it can run a simple binary.
In this situation it will discover that it can, in fact, run 32-bit
binaries and will run any such tests that require running a test
program:

     checking for printf floating point output in hex notation... yes

The relevant part of the config.log for the case where I specify --build is:

     configure:29762: checking for printf floating point output in hex notation
     configure:29768: WARNING: cannot check printf if cross compiling
-- defaulting to no
     configure:29832: result: no

whereas the relevant part of the config.log for when I only specify --host is:

     configure:29762: checking for printf floating point output in hex notation
     configure:29800: i686-nptl-linux-gnu-gcc -o conftest -g -O2
conftest.c -ldl  >&5
     conftest.c: In function 'main':
     conftest.c:356:2: warning: incompatible implicit declaration of
built-in function 'exit'
     configure:29804: $? = 0
     configure:29810: ./conftest
     configure:29814: $? = 0
     configure:29832: result: yes

Of course if you are targeting a platform whose binaries you can't run
it makes no difference (provided you've specified your --build tuple
accurately).

So considering a person might specify the tuple incorrectly and the
./configure script is more robust it sounds like good advice to not
specify the --build tuple.

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]