Bug 141206

Summary: rpmbuild --target=i586 fails on x64_64
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Volker Kuhlmann <bugz57>
Component: DevelopmentAssignee: Michael Schröder <mls>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: pth
Version: Final   
Target Milestone: ---   
Hardware: x86-64   
OS: SuSE Linux 10.0   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Volker Kuhlmann 2006-01-03 04:37:41 UTC
rpmbuild --target=i586 with a spec file using make CFLAGS="$RPM_OPTFLAGS ..." always fails on an AMD64 machine, because the compiler is unable to generate 32bit code:

gcc -march=i586 -c -o xxx.o xxx.c
xxx.c:1: error: CPU you selected does not support x86-64 instruction set

Packages installed:

cpp-4.0.2_20050901-3
gcc-32bit-4.0.2_20050901-3
gcc-4.0.2_20050901-3
glibc-32bit-2.3.5-40
glibc-devel-32bit-2.3.5-40
libgcc-4.0.2_20050901-3

It seems the -m32 flag is additionally absolutely essential: gcc -m32 -march=i686 works. However, $RPM_OPT_FLAGS doesn't supply this. I don't know why -m32 is additionally required as -march=i586 ought to be sufficient.

rpm should be fixed with this patch:

--- /usr/lib/rpm/rpmrc.orig	2005-09-10 04:39:38.000000000 +1200
+++ /usr/lib/rpm/rpmrc	2006-01-03 17:02:30.000000000 +1300
@@ -13,8 +13,8 @@
 
 optflags: i386 -O2 -g -march=i486 -fmessage-length=0 -D_FORTIFY_SOURCE=2
 optflags: i486 -O2 -g -march=i486
-optflags: i586 -O2 -g -march=i586 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2
-optflags: i686 -O2 -g -march=i686 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2
+optflags: i586 -O2 -g -m32 -march=i586 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2
+optflags: i686 -O2 -g -m32 -march=i686 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2
 optflags: athlon -O2 -g -march=athlon
 optflags: ia64 -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2
 optflags: x86_64 -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2


(Probably dito for 486 and 386.)
Comment 1 Michael Schröder 2006-02-18 16:25:34 UTC
Fixed in STABLE.