I know bugzilla is my friend and I will put this in bugzilla, but I believe
this needs many eyes, so hence I'm first discussing it here.
Currently when building rpms on an i686 and using %configure in your specfile
rpmbuild calls configure like this (non interesting stuff removed):
./configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu
--target=i386-redhat-linux-gnu
This is just plain wrong, this should be:
./configure --build=i686-pc-linux-gnu --host=i386-redhat-linux-gnu
--target=i386-redhat-linux-gnu
Or preferable just:
./configure --build=i686-pc-linux-gnu --host=i386-redhat-linux-gnu
Here is a chapter of the autotools book describing the meaning of --build
--target and --host:
Normally one only needs to specify build and host:
--build specifies the canonical name of the system on which the packages is
build
--host specifies the canonical name of the system on which the packages will
run
So clearly specifying a host of i686-pc-linux-gnu for .i386 rpms is wrong, as
then some packages (ode for example) will unconditionally use i686 inline
assembly, which of course won't work on an i386. At first I thought this was a
bug in the upstream configure but it is not when --host says its an i686,
unconditionally using i686 asm is fine, thus upstream is not to blame but our
invocation of configure is to blame.
For completeness sake, as said --target really should (normally) not be passed
(it will then default to whatever --host is):
--target specifies the canonical name of the system for which any code
generated by the package when run should be generated
So --target really only is relevant when building things like binutils and gcc
and thus should not be specified by default.
An example to hopefully make things clearer, lets say I'm building gcc on an
i686 and I want to run the resulting gcc binaries on a powerpc using Fedora,
and I want the gcc binaries to generate code for an arm, then I would specify:
There is one problem here though, now the --build and --host strings are not
equal, so autoconf will assume we're cross-compiling which isn't really true.
A solution for this would be to invoke configure like this:
./configure --build=i386-redhat-linux-gnu --host=i386-redhat-linux-gnu
Note this (with an unnecessary identical --target added) is currently what
(luckily) happens in koji.
But when doing a local test build using "make i386" configure gets invoked
wrongly. Can we fix please this inconsistency between local rpmbuild's and koji?
Thanks & Regards,
Hans
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
07-11-2008, 09:57 AM
Ralf Corsepius
rpmbuild passes wrong --host option to configure
On Fri, 2008-07-11 at 11:47 +0200, Hans de Goede wrote:
> Hi all,
>
> I know bugzilla is my friend and I will put this in bugzilla, but I believe
> this needs many eyes, so hence I'm first discussing it here.
>
> Currently when building rpms on an i686 and using %configure in your specfile
> rpmbuild calls configure like this (non interesting stuff removed):
> ./configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu
> --target=i386-redhat-linux-gnu
>
> This is just plain wrong, this should be:
> ./configure --build=i686-pc-linux-gnu --host=i386-redhat-linux-gnu
> --target=i386-redhat-linux-gnu
Both are wrong.
Both use the wrong target
The latter is worse: it trigger cross-compilation mode, because
build != host.
> Or preferable just:
> ./configure --build=i686-pc-linux-gnu --host=i386-redhat-linux-gnu
Preferable is ./configure, because then build and host will be autodetected.
> Here is a chapter of the autotools book describing the meaning of --build
> --target and --host:
> http://www.ensta.fr/~diam/dev/online/autoconf/autobook/autobook_259.html
>
>
> Normally one only needs to specify build and host:
> --build specifies the canonical name of the system on which the packages is
> build
> --host specifies the canonical name of the system on which the packages will
> run
>
> So clearly specifying a host of i686-pc-linux-gnu for .i386 rpms is wrong,
Once more: no.
The target-tuples actually specify the name of the canonicalized
toolchain. I.e. configure scripts will pick up i686-pc-linux-gnu-gcc and
set CC to it if --host=i686-pc-linux-gnu is given and if build != host.
Whether this CC generates i386 or i686 is a matter of the CFLAGS being
passed to the CC.
However, I agree. Using i686-* as target tuple isn't necessarily a wise
decision.
> An example to hopefully make things clearer, lets say I'm building gcc on an
> i686 and I want to run the resulting gcc binaries on a powerpc using Fedora,
> and I want the gcc binaries to generate code for an arm, then I would specify:
> ./configure --build=i686-pc-linux-gnu --host=powerpc-redhat-linux-gnu
> --target=arm-redhat-linux-gnu
>
> (Yes that would be cross compiling a cross compiler).
It would not be simple cross-compilation.
Your example is a case of Canadian cross-compilation. It's one magnitude more difficult.
> As said the correct invocation of ./configure on an i686 to build .i386 rpms
> would be:
> ./configure --build=i686-pc-linux-gnu --host=i386-redhat-linux-gnu
No.
> There is one problem here though, now the --build and --host strings are not
> equal, so autoconf will assume we're cross-compiling which isn't really true.
Correct. Your proposal triggers cross-compilation.
> A solution for this would be to invoke configure like this:
> ./configure --build=i386-redhat-linux-gnu --host=i386-redhat-linux-gnu
Correct. This would not trigger cross-compilation.
Ralf
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list