Subject: Re: C compiler flags
To: None <pkgsrc-users@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: pkgsrc-users
Date: 11/19/2006 20:28:09
Matthias Scheler wrote:
> On Tue, Nov 14, 2006 at 12:08:49AM +0100, Ricardo Cervera Navarro wrote:
> 1.) Please do *not* modify "CFLAGS" in "/etc/mk.conf". You will cause
> various build failures.
> 2.) Please do *not* try to enforce using "-O2". There are packages which
> build without optimization by purpose.
It would be nice if someone could mention at least one of these packages. I'm
just curious how and why these break. Every little thing can cause a build
failure, even the wrong moon phase. Declaring some fairly common, useful and
even conservative compiler flags as evil seems a bit helpless.
> The correct setting is:
>
> COPTS= -march=athlon
> Or you could use the "cpuflags" package.
Huh, I always considered COPTS being part of the NetBSD build.sh stuff but
not pkgsrc. It's not documented in pkgsrc.txt anyway.
The only package I'm aware of that will likely break is MPlayer but I'm
pretty sure it would break just like that whether you use COPTS or CFLAGS
assuming COPTS is actually used by pkgsrc.
Optimization isn't everything, I really like to have my -W -Wall -Wformat=2
-Wshadow because now and then it shows that I want to stay away from the
package. Many warnings are certainly harmless but I don't see any reason why
anyone would brush these under the carpet. Especially in the context of a
multi-platform package management system, such early diagnosis should be very
useful.
--
Christian