Setting CPUTYPE and CFLAGS in make.conf

Roland Smith rsmith at
Wed Apr 9 19:11:10 UTC 2008

On Wed, Apr 09, 2008 at 11:35:51AM -0700, David Allen wrote:
> > Avoid setting CFLAGS unless you have a good reason - Gentoo
> > documentation has a lot to answer for. CPUTYPE causes "-march" to be
> > applied, so it can affect compatibility. AFAIK both setting do affect
> > world and kernel because CFLAGS can cause a build to fail, and I've
> > seen matching march settings in kernel builds.
> >
> > > Or are those settings relevant to the
> > > compilation process only?  Or to both the compilation process and the
> > > actual performance of the binary?
> >
> > It can be either, -O2 is related to execution, -pipe speeds-up
> > compilation.
> Thank you for your reply.   It's starting to make a lot more sense.
> Just to confirm, then, if there's no CPUTYPE set,  I can then set up
> a build server on an Opteron box, for example, to build world, kernel
> and ports binaries that can then be installed on my Thinkpad or
> a PIII box?

Only if they use the same architecture! If your opteron is running amd64, its
binaries won't run on a pIII, which can only run the i386 architecture.

If you read through /usr/src/share/mk/ you can see the
different CPU types and the effect they have on build
parameters. E.g. on the i386 architecture, if no CPUTYPE is set, the CPU
type is set to i486, which is the lowest common denominator that gcc supports.

[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list