rpmbuild --target=i686 on x86_64 fails in configure

Zoltan Boszormenyi zboszor at freemail.hu
Sat Apr 14 14:53:50 UTC 2012


yesterday I installed Fedora 17 Beta RC4/x86_64 on my laptop and
wanted to compile newer than Mesa 8.0 to see the future of Linux
gaming. ;-) Since a lot of -devel packages can live happily in both
32- and 64-bit forms, I wanted to compile both versions of Mesa GIT.
To do that, I also needed a new libdrm from GIT.

"rpmbuild -ba libdrm.spec" succeeded, using the current src.rpm
and switching out the source tree under it. The patches listed in
libdrm.spec still apply correctly.

However, "rpmbuilt -ba --target=i686 libdrm.spec" fails:

[zozo at localhost SPECS]$ rpmbuild -ba --target=i686 libdrm.spec
autoreconf: Leaving directory `.'
+ CFLAGS='-O2 -g -march=i686'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -march=i686'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -march=i686'
+ export FFLAGS
+ ./configure --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu 
--program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin 
--sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib 
--libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib 
--mandir=/usr/share/man --infodir=/usr/share/info --enable-udev 
--enable-nouveau-experimental-api --enable-libkms
configure: WARNING: unrecognized options: --enable-nouveau-experimental-api
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... yes
checking for x86_64-unknown-linux-gnu-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/zozo/rpmbuild/BUILD/libdrm-2.4.33':
configure: error: C compiler cannot create executables
See `config.log' for more details
error: Bad exit status from /var/tmp/rpm-tmp.RGnIK6 (%build)

RPM build errors:
     Bad exit status from /var/tmp/rpm-tmp.RGnIK6 (%build)

config.log tells me this:

configure:3263: checking whether the C compiler works
configure:3285: gcc -O2 -g -march=i686   conftest.c >&5
conftest.c:1:0: error: CPU you selected does not support x86-64 instruction set

The problem is obvious: "rpmbuild --target=i686" only adds "-march=i686"
without "-m32". Compiling a minimal C source like the one below with
"gcc -m32 -o a a.c" succeeds and properly produces a 32-bit binary.

int main(void) { return 0; }

$ rpm -q rpm rpm-build

What should I do to make rpmbuild work for --target=i686?
I don't remember needing anything special under Fedora 16?

Best regards,
Zoltán Böszörményi

More information about the test mailing list