Bug 141206 - rpmbuild --target=i586 fails on x64_64
Summary: rpmbuild --target=i586 fails on x64_64
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Development (show other bugs)
Version: Final
Hardware: x86-64 SuSE Linux 10.0
: P5 - None : Normal
Target Milestone: ---
Assignee: Michael Schröder
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-03 04:37 UTC by Volker Kuhlmann
Modified: 2006-02-18 16:25 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.