generating 32-bit RPM's

Jonathan Berry berryja at gmail.com
Fri Sep 9 16:52:20 UTC 2005


On 9/9/05, Joshua Jensen <joshua at iwsp.com> wrote:
> When compiling the kernel on 32bit platforms, you can specify --target
> of say i686 which activates %ifarch sections inside of the specfile.

Agreed.

> However, all that really does is use different "-m" compiler switches
> for CPU optimization.  So first off, you have to have the %ifarch stuff
> defined in your package's specfile (almost no RPMs do), and you would

I don't know about the "almost no RPMs do."  Almost all RPMs are built
for multiple architectures.

> have to have a *cross compiler* installed on your x86_64 platform.  I
> don't know that -m32 does all that you need.

But, 32-bit and 64-bit are both x86.  It's not like he's trying to
compile for SPARC or PowerPC here, which *would* need a
cross-compiler.  See below.

> produce 32bit binaries.  I'm not a compiler wizard, but from my
> understanding the 64 bit gcc that ships with Red Hat on x86_64 platforms
> only targets x86_64 CPUs.
> 
> Joshua

Well, from the gcc man page:

       -m32
       -m64
           Generate code for a 32-bit or 64-bit environment.  The 32-bit envi-
           ronment sets int, long and pointer to 32 bits and generates code
           that runs on any i386 system.  The 64-bit environment sets int to
           32 bits and long and pointer to 64 bits and generates code for
           AMD's x86-64 architecture.

which sounds a lot like -m32 makes gcc compile 32-bit programs.  Of
course, an experiment is worth a thousand man-page words :), so I'll
try this out sometime and see what happens.  If you are linking to
libraries, you will of course need to also make sure you link to
32-bit libs or else ld (the linker) won't like you too well :).

Jonathan




More information about the amd64-list mailing list