[CentOS] Re: gcc -m32 on a x86_64 box

Wed Nov 29 08:24:56 UTC 2006
Kay Diederichs <kay.diederichs at uni-konstanz.de>

Johnny Hughes wrote:
> 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 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos

I have never had any problems with a mix of 64bit and 32bit libraries as 
long as I used the RHEL(or rather, CentOS)-supplied RPMs - the libraries 
are stored in different places, and the loader and compilers know about 
this.

One very helpful way is to have the line

%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}

in /etc/rpm/macros. This makes you see the architecture in all rpm -q 
queries.

Kay