cc -m32 (was Re: critical floating point incompatibility

Bakul Shah bakul at
Thu Jan 29 14:11:35 PST 2009

On Fri, 30 Jan 2009 05:44:00 +1100 Peter Jeremy <peterjeremy at>  wrote:
> On 2009-Jan-28 11:24:21 -0800, Bakul Shah <bakul at> wrote:
> >On a mac, cc -m64 builds 64 bit binaries and cc -m32 builds
> >32 bit binaries.  The following script makes it as easy to do
> >so on a 64 bit FreeBSD -- at least on the few programs I
> >tried.  Ideally the right magic needs to be folded in gcc's
> >builtin "specs".
> >
> >#!/bin/sh
> >args=3D/usr/bin/cc
> >while [ ".$1" !=3D . ]
> >do
> >    a=3D$1; shift
> >    case $a in
> >    -m32) args=3D"$args -B/usr/lib32 -I/usr/include32 -m32";;
> >    *) args=3D"$args $a";;
> >    esac
> >done
> >$args
> You also need to manually populate /usr/include32 since it doesn't
> exist by default and may still get bitten by stuff in
> /usr/local/include.  Do you have a script (or installworld patches) to
> do this?

Yes, includes for native programs will may cause trouble --
but you can't use -nostdinc (as that would take away that
feature from a user), which is why this needs to be in the
gcc specs.

I don't have a script as I just copied include directories
from a i386 system.  But a script would be better.  This
script was an initial stab at proper -m32 support and needs
more work.  I will be happy to work with you or anyone else
to make this happen.

More information about the freebsd-hackers mailing list