Bug 591035

Summary: gcc -m32 error message not helpful
Product: [Fedora] Fedora Reporter: Benjamin Otte <otte>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-14 09:52:05 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 Benjamin Otte 2010-05-11 09:49:31 UTC
Description of problem:
When compiling a simple file with gcc -m32 on a 64bit box, the error message is not very helpful.

Version-Release number of selected component (if applicable):
gcc-4.4.4-2

How reproducible:
always

Steps to Reproduce:
1. Install a x86_64 system.
2. Install required i686 devel packages to build: glibc-devel.i686 is enough for a simple test program.
3. Run `gcc -m32 test.c` 
  
Actual results:
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.4/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.4/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

Expected results:
The "libgcc.i686" package gets pulled in by glibc-devel.
Or at least I get an error message that hints at the problem. I'd even settle for ld reporting that usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/libgcc_s.so is a dangling symlink.

Additional info:
I wanted to test some of my code on 32bit and googling showed that it's easy to achieve with CC="gcc -m32". When doing that, I ran into this problem and that took me quite a bit of time to figure this missing package out, as it's not at all obvious that it's not installed automatically.

Comment 1 Jakub Jelinek 2010-05-14 09:52:05 UTC
That error is from the linker, not from gcc.  And gcc certainly can't require the 32-bit devel packages in 64-bit gcc, they aren't necessary for building 64-bit code.

Comment 2 Benjamin Otte 2010-05-14 12:13:06 UTC
So you're saying it's intended behavior that by default gcc fails and the user is left with an unhelpful error message?