rpmbuild passes wrong --host option to configure
Ralf Corsepius
rc040203 at freenet.de
Fri Jul 11 09:57:20 UTC 2008
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
More information about the fedora-devel-list
mailing list