[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpmbuild passes wrong --host option to configure



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

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:
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, 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:
./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).


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

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]