Compiling 32bit on 64bit Fedora

Adam Williamson awilliam at redhat.com
Wed Sep 7 19:35:41 UTC 2011


On Wed, 2011-09-07 at 11:52 -0400, Nathaniel McCallum wrote:
> "gcc -m32 -o foo foo.c" gives me:
> /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file
> or directory
> 
> If I copy the gnu/stubs-32.h file from the 32bit glibc-devel package
> into the right place and run the command above again I get:
> /usr/bin/ld: cannot find crt1.o: No such file or directory
> /usr/bin/ld: cannot find crti.o: No such file or directory
> /usr/bin/ld: skipping
> incompatible /usr/lib/gcc/x86_64-redhat-linux/4.6.1/libgcc_s.so when
> searching for -lgcc_s
> /usr/bin/ld: cannot find -lgcc_s
> /usr/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for
> -lc
> /usr/bin/ld: cannot find -lc
> /usr/bin/ld: skipping
> incompatible /usr/lib/gcc/x86_64-redhat-linux/4.6.1/libgcc_s.so when
> searching for -lgcc_s
> /usr/bin/ld: cannot find -lgcc_s
> /usr/bin/ld: cannot find crtn.o: No such file or directory
> collect2: ld returned 1 exit status
> 
> Hrm...
> 
> Am I doing something wrong? Or is this a packaging bug? I can't think of
> any reason why I shouldn't be able to compile at least a basic C program
> with no deps as 32bit on 64bit.

it's worth noting a 'cleaner' way to do this than messing up your main
system with 32-bit packages is to use mock: you can use mock -r
fedora-16-i386 --shell to give yourself interactive access to a nice
clean 32-bit buildroot, then install all the devel packages and
compilers you need, and build your code. Might not be what you want, but
I thought it was worth mentioning.
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | identi.ca: adamwfedora
http://www.happyassassin.net



More information about the devel mailing list