Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2001 23:30:03 -0400
From:      "Matthew Emmerton" <matt@gsicomp.on.ca>
To:        <freebsd-ports@freebsd.org>, <freebsd-questions@freebsd.org>
Subject:   SOLVED:  Problem with '-O -pipe' showing up in CFLAGS / CXXFLAGS
Message-ID:  <001701c1285f$3c4a48f0$1200a8c0@gsicomp.on.ca>

next in thread | raw e-mail | index | archive | help
Over the past while I've seen a few people having troubles building ports
and/or kernels. I always thought it was people setting CFLAGS and/or
CXXFLAGS in their environment improperly or having /etc/make.conf configured
with '-O -pipe', as did many others.

However, it finally happened to me, and I know I don't do either of these.
After a couple of hours of investigation, the culprit was found:    BSD make
and improperly designed Makefiles.  I'm posting my findings here in hopes
that others will find it useful.

Take, for example, the Makefile for biology/xdrawchem, which contains the
following line:

MAKE_ENV=       CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" QTDIR="${X11BASE}"

Looks innocent enough, right?  After all, we want MAKE_ENV to have those
things set right.  However, this is WRONG, on two counts.

First, bsd.port.mk will pick up CXX and CXXFLAGS (and CC and CFLAGS) from
the environment so they don't need to be set explicitly here.

Second, if CXX and CXXFLAGS are *not* set in the environment, make handily
supplies its own defaults, which are inappropriate:

gabby# make -X -V CXXFLAGS
${CXXINCLUDES} ${CFLAGS}
gabby# make -X -V CFLAGS
-O -pipe ${_CPUCFLAGS}

This is why we end up with '-O -pipe' in CFLAGS/CXXFLAGS, and as many people
have indicated, throws many things for a loop.  (In my case, g++ chews up
100% of available memory and swap while trying to optimize one of the source
modules in xdrawchem.)

--
Matt Emmerton


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001701c1285f$3c4a48f0$1200a8c0>