[CentOS] gcc -m32 on a x86_64 box

Tue Nov 28 01:24:24 UTC 2006
Johnny Hughes <mailing-lists at hughesjr.com>

On Mon, 2006-11-27 at 13:27 -0500, Jerry Geis wrote:
> >On Mon, Nov 27, 2006 at 01:05:22PM -0500, Jerry Geis wrote:
> >>/ Gents,
> />>/ I am trying to do a "gcc -m32" on a x86_64 box.
> />>/ gcc -m32 /tmp/jj.c
> />>/ /usr/bin/ld: crt1.o: No such file: No such file or directory
> />>/ collect2: ld returned 1 exit status
> />>/ This is the error I get.
> />>/ I did a "yum install glib.i386" successfully.
> />>/ there is no "yum install glib-devel.i386".
> />>/ How can i get a  "gcc -m32" compile on my x86_64?>>
> /
> >try
> 
> >setarch i386 gcc -m32
> 
> That did not do it either....
> 
> My jj.c program is basically hello world.
> 
> #include <stdio.h>
> 
> int main(int argc, char *argv[])
> {
> printf("Hello world\n");
> }
> 
> when I run "setarch i386 gcc -m32 jj.c"
> 
> I still get.
> 
> setarch i386 gcc -m32 jj.c
> /usr/bin/ld: crt1.o: No such file: No such file or directory
> collect2: ld returned 1 exit status
> 
> 
> Am I missing something?
> 

I order to build 32 bit programs on an x86_64 machine, I would create a
totally 32 bit chroot on that machine.

Inside the 32 bit chroot, you will still need to use "setarch i386" in
front of your make commands (or rpmbuild commands).

If you want to build 64bit stuff, you need to have a fully x86_64 only
machine (with the only x86 RPMS being glibc.i686 and glibc-devel.i386).

If you have other i386 rpms in the x86_64 build tree, you will
inevitably get 32bit stuff in your 64 bit compiles ... and if you have
x86_64 items in your i386 build tree, you will inevitably pollute your
32 bit items with 64bit libraries ... 

Thanks,
Johnny Hughes 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.centos.org/pipermail/centos/attachments/20061127/040b2a71/attachment-0005.sig>