need info builing ports properly
matthew at FreeBSD.org
Wed Mar 28 16:52:59 UTC 2012
On 28/03/2012 15:40, icemac wrote:
> Thanks for your quick reply, but can you clarify what you mean about not
> 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 is
> 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
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:
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.
Dr Matthew J Seaman MA, D.Phil.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20120328/ac15f2eb/signature.pgp
More information about the freebsd-questions