How to not use OPTIMIZED_FLAGS properly

b. f. bf1783 at googlemail.com
Mon Feb 7 19:30:32 UTC 2011


> 07.02.2011 20:50, Konstantin Tokarev пишет:
> >
> >
> > 07.02.2011, 20:34, "Ruslan Mahmatkhanov"<cvs-src at yandex.ru>:
> >> Hello.
> >>
> >> I'm working on port that doesn't builds with "-O2 -pipe", that passed to
> >> Makefile by default (it exits with message about virtual memory is
> >> exhausted). I can avoid this by setting CFLAGS="" and CXXFLAGS="" in
> >> CONFIGURE_ENV. But portlint is complaining like this:
> >>
> >> WARN: Makefile: CFLAGS/CXXFLAGS are not needed in CONFIGURE_ENV as they
> >> are already added there in bsd.port.mk.
> >> FATAL: Makefile: CFLAGS are clobbered in CONFIGURE_ENV.  Alter CFLAGS in
> >> the Makefile with CFLAGS+=... instead
> >> FATAL: Makefile: CXXFLAGS are clobbered in CONFIGURE_ENV.  Alter
> >> CXXFLAGS in the Makefile with CXXFLAGS+=... instead
> >>
> >> What is the right way to do the job?
> >>
> >> PS. If i set -O0 in CONFIGURE_ENV, it's later redefined to "-O2 -pipe".
> >
> > Have you tried CFLAGS+=-O0 as portlint suggested?
>
> As i said before i tried that. If i'm using +=-O0 then it changes to -O2
> -pipe. If i'm using =-O0, then all builds fine, but this make portlint
> complaining.

CFLAGS and CXXFLAGS are already passed by default in do-configure, as
portlint states.  Why aren't you simply defining them, by themselves
and not as a part of CONFIGURE_ENV, in the port Makefile?:

CFLAGS+=-O0

This seems pessimistic, by the way.  Have you tried adding other
compiler flags, like those to control the compiler's memory usage? Or
using another compiler via USE_GCC, or patching the source code?

b.


More information about the freebsd-ports mailing list