Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2012 17:52:49 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@FreeBSD.org
Subject:   Re: need info builing ports properly
Message-ID:  <4F7341E1.8010407@FreeBSD.org>
In-Reply-To: <4F7322E8.1040502@gmail.com>
References:  <4F731B60.7020207@gmail.com> <op.wbvwu0t034t2sn@tech304> <4F7322E8.1040502@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig2AC0099E965BB7D778F003A6
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 28/03/2012 15:40, icemac wrote:
> Thanks for your quick reply, but can you clarify what you mean about no=
t
> messing with the CFLAGS?
> I mean I had only ever used that one setting taken from the example in
> /usr/share/examples/etc/make.conf, and the only experimentation i did i=
s
> either with it in make.conf, or nothing at all.

Modifying CFLAGS like that is something that sounds attractive; an easy
win in making your system perform better.  However, you should ask
yourself if it's really such a good idea, then why isn't it already the
default?  I can tell you that if there weren't some significant
downsides to maxing out the optimization levels, then that would
certainly be the case.

In actuality, the optimization level (-O2, etc) has an inconsistent
effect and is very much dependent on the nature of the code being
compiled.  In fact, for the FreeBSD kernel specifically it is known that
it can be counter-productive.

Much of the time for ports, it doesn't really make a great deal of
difference what the setting is.  Ports that can benefit will frequently
have OPTIONS to turn up the optimization level, to be set on a per-port
basis.

One of the few things that is known to have a generally beneficial
effect is to set the CPUTYPE variable appropriately.  You can just say:

CPUTYPE=3Dnative

and the compiler will work out exactly what CPU you have automatically.

The downside, of course, is that you make anything compiled on your
system specific to particular CPU variants, so it's not something that
could be done for software intended to be generally installable anywhere.=


> Do mean its proper not to have it at all in /etc/make.conf or about
> changing it's values?

Setting CFLAGS is not really improper, but it is not the panacea many
people seem to think it is.  It takes patience, plenty of trial and
error, a deep understanding of compilers and so forth to achieve much.

> At the moment my /etc/make.conf just has 1 line with the Perl version
> entry, should i always leave cflags out?

I think that not setting CLFAGS would be sensible.  There's plenty of
other stuff you can fiddle with in /etc/make.conf or /etc/src.conf if
that's what interests you.  OTOH, the default settings are pretty good
and leaving well alone will help you get a put together a stable and
reliable system without excessive pain.

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey



--------------enig2AC0099E965BB7D778F003A6
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9zQeIACgkQ8Mjk52CukIywhgCgh6lYH7F8+sWt3ybWrbgPOW+v
Bg4AnA3qkkQkEQI5uugZf3AtcgJGfF1M
=vTmA
-----END PGP SIGNATURE-----

--------------enig2AC0099E965BB7D778F003A6--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F7341E1.8010407>