On Tue, 2006-10-17 at 23:48 +0200, Michael S. Tsirkin wrote:
> Quoting r. Doug Ledford <[EMAIL PROTECTED]>:
> > Subject: Re: RHEL5 and OFED ...
> > 
> > On Tue, 2006-10-17 at 22:28 +0200, Michael S. Tsirkin wrote:
> > > On a tangent, is there a way to set up a cross-build environment that will
> > > build kernel modules for e.g. RHEL amd64 kernel on a 32 bit machine?
> > > I'm doing this now with gcc and kernel.org kernel I built myself from 
> > > source.
> > > I guess I mostly need to get gcc and binutils SRPMs to generate
> > > cross-compiling tools - has anyone done that?
> > 
> > At least for Red Hat, rpm already mostly supports this with only a few
> > examples of breakage (apps needing gfortran like openmpi are an example
> > that might break depending on usage).
> 
> So, you are saying I shuld rpmbuild binutils and gcc rpms?
> Hmm, I'll give it a try.

No.  To build an i686 binary on an x86_64 only requires passing -m32 to
the compiler.  It will then build the 32bit variant instead of the
64bit.  I'm not saying rpmbuild gcc and binutils, because the variants
installed will already do what you want (assuming building 32bit on
64bit is what you want, but I see that isn't the case on down).

> >  You can
> > call rpmbuild with the --target option to specify the mode you want the
> > package built as
> 
> Hmm, no, I really want to take a srpm from amd64 and get a 32 bit
> gcc executable that will build 64 bit binaries that match these
> built on native amd64 system exectly.

Between just i386 and x86_64, you might be able to do that.  However, in
general, byte for byte identical cross compiling can't be done.  That's
one of the reasons we build all the packages on the arch they are being
built for, so if a user rebuilds a package on the arch then it will most
likely match the package we built.  If we cross compiled, that would be
false more often than true.  Minor things like variance in how CPUs
handle floating point math and precision of said math effect gcc
optimization decisions and change the generated byte code.

In any case, I'm certainly no gcc build expert, so I don't know the
magic incantations to get the gcc sources to spit out a 32bit binary
that builds 64bit code.  Far easier would be to go the other way around,
run on x86_64 and build for i386, in which case gcc supports that out of
the box.

-- 
Doug Ledford <[EMAIL PROTECTED]>
              GPG KeyID: CFBFF194
              http://people.redhat.com/dledford

Infiniband specific RPMs available at
              http://people.redhat.com/dledford/Infiniband

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to