[CentOS] 32-bit compat-gcc on 64-bit CentOS?

Denniston, Todd A CIV NAVSURFWARCENDIV Crane todd.denniston at navy.mil
Wed Mar 30 18:33:42 UTC 2011



> -----Original Message-----
> From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On
> Behalf Of Alan M. Evans
> Sent: Wednesday, March 30, 2011 12:48
> To: CentOS mailing list
> Subject: Re: [CentOS] 32-bit compat-gcc on 64-bit CentOS?
> 
> On Tue, 2011-03-29 at 17:43 -0500, Jeff wrote:
> > On Tue, Mar 29, 2011 at 5:35 PM, Alan M. Evans <ame1 at extratech.com>
wrote:
 
> > , but
> > have  you tried the -m32 flag with gcc. that will tell it to create
> > 32-bit code. You will also need to pass that option to the linker
and
> > be sure any dependent libraries have the 32 bit versions installed.
> 
> I've tried the -m32 flag, along with "CC=gcc34" to actually cause it
to
> use the compat compiler instead of the new one. The build process
> produces a lot of warnings that may or may not have been there before,
> then bails out with:
> 
> make: *** No rule to make target `/usr/lib/gcc/i386-redhat-
> linux/3.4.6/include/stdarg.h', needed by `hostcom.o'.  Stop.
> 
> On the old server, which I have limited access to, that file is owned
> by
> the compat-gcc-34 package. And the 64-bit version of this package is
> installed on the new server, so the directory is x86_64-redhat-linux
> instead of i386-redhat-linux.
> 

Unfortunately, from what I see, the x86_64 yum repos only offer an
x86_64 version of compat-gcc-34.
compat-gcc-34.x86_64 has
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include/stdarg.h

*Perhaps* this (that it does not provide the *gcc/i386-* include tree,
or that the i386 version is not also in the x86_64 repo) can be seen as
a bug in the x86_64 package, to report upstream???

The error above looks like either by specifying the -m32 flag or by a
hard code in either hostcom.c (or one of its included files) the 32bit
version of the stdarg.h header is included instead of the available
x86_64 version.

Seeing as you have source I would first try to compile it as 64bit and
if the build works, then test heavily to verify the functionality.  
The drawback is that we have seen several open source projects*** with
issues while they ported their software from 32 to 64.  Perhaps there is
a URL of Frequently seen 32 to 64 bit porting problems, that you could
look at to be aware of the kinds of errors others have seen.

Again my first option would be try to go native (x86_64) and see if it
works correctly.

Another option to keep from reinstalling, granted only slightly easier
than reinstalling, is setup a KVM or XEN virtual machine on the server
and install enough of the 32 bit CentOS to allow you to compile the
source in a 32 bit environment and then install the binary onto the 64
bit system and make sure all the needed 32bit libs are available. You
might even be able to fallback to running just that application in the
VM while running everything else in the bare metal, granted then you get
twice the effort for securing the OS (it IS another machine) and keeping
the OS up to date.

Third option may be as others suggested, try to use mock to build the
32bit binary using the 64bit system.  You would still need to make sure
all the needed 32bit libs are available on the 64bit machine. [I have
not used mock yet so I am unsure of the ability for it to provide the
cross environment needed.]


*** ( the closed ones probably had issues too, but well being closed we
don't hear about them. :)

My opinions, YMMV and all that jazz.



More information about the CentOS mailing list