Bug 658236

Summary: RFE: cross-arch build for i686 on x86_64
Product: [Fedora] Fedora Reporter: John Reiser <jreiser>
Component: glibcAssignee: Andreas Schwab <schwab>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: fweimer, jakub, pahan, schwab
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-02 13:44:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Reiser 2010-11-29 18:47:09 UTC
Description of problem: It should be simple, obvious, and successful to build .rpms for i686 using a x86_64 system.  Please make it so.

Currently it fails in three ways.
1. The "-m32" is not set when defining GCC in glibc.spec, leading to a failure in the .config step: "LD/glibc-2.12-216-g3540d66/build-i686-linuxnptl':
configure: error: cannot compute suffix of object files: cannot compile
". 
2. After supplying -m32 under "%ifarch {%ix86}", then after some time there is a mysterious failure "sed: can't read {%_topdir}/rpmbuild/BUILDROOT/glibc-2.12.90-19.i386/usr/bin/memusage: No such file or directory".
3. The mystery of case 2) persists even when using "setarch i686 rpmbuild -ba ..."



Version-Release number of selected component (if applicable):
glibc-2.12.90-19.src.rpm


How reproducible: every time


Steps to Reproduce:
1. "rpmbuild -ba --target i686 glibc.spec" using a x86_64 system
2.
3.
  
Actual results:
As in Description above.

Expected results: successful build


Additional info:

Comment 1 Andreas Schwab 2010-12-02 13:44:45 UTC
You need to install all build requirements.

Comment 2 John Reiser 2010-12-03 15:46:19 UTC
At least in theory for "-bc" it should work in the other direction, too: compile for x86_64 using a i686 system.  That fails:
-----rpmbuild -bc --target x86_64 glibc.spec    # on i686
gawk -f ../scripts/gen-as-const.awk ../sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym \
| gcc -S  <<snipped>>  BUILD/glibc-2.12-216-g3540d66/build-x86_64-linuxnptl/ucontext_i.h

<stdin>: In function 'dummy':
<stdin>:11:61: error: 'REG_RBP' undeclared (first use in this function)
<stdin>:11:61: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:12:61: error: 'REG_RSP' undeclared (first use in this function)
   ...
-----
and the first required fix is adding "-m64" to the .spec:
-----
%build
%ifarch %{ix86}
GCC="gcc -m32"
GXX="g++ -m32"
%else
GCC="gcc -m64"
GXX="g++ -m64"
%endif
-----
but that goes almost nowhere because typical gcc for i686 does not support 64-bit mode:
-----
configure:2775: gcc -m64 -c -mtune=generic -fasynchronous-unwind-tables -g -O3  -fno-asynchronous-unwind-tables  conftest.c >&5
conftest.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
-----
So that infelicity is not due to glibc.spec.

Yet the  GCC="gcc -m32"  does belong in the .spec for producing i686 using x86_64.