From owner-freebsd-questions Sat Aug 18 20:54: 6 2001 Delivered-To: freebsd-questions@freebsd.org Received: from tomts8-srv.bellnexxia.net (tomts8.bellnexxia.net [209.226.175.52]) by hub.freebsd.org (Postfix) with ESMTP id D417B37B405; Sat, 18 Aug 2001 20:53:56 -0700 (PDT) (envelope-from matt@gsicomp.on.ca) Received: from xena.gsicomp.on.ca ([64.228.155.124]) by tomts8-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20010819035351.HLQG27547.tomts8-srv.bellnexxia.net@xena.gsicomp.on.ca>; Sat, 18 Aug 2001 23:53:51 -0400 Received: from hermes (hermes.gsicomp.on.ca [192.168.0.18]) by xena.gsicomp.on.ca (8.11.1/8.11.1) with SMTP id f7J3pEc74411; Sat, 18 Aug 2001 23:51:14 -0400 (EDT) (envelope-from matt@gsicomp.on.ca) Message-ID: <002b01c12861$95de5800$1200a8c0@gsicomp.on.ca> From: "Matthew Emmerton" To: "Matthew Emmerton" , , References: <001701c1285f$3c4a48f0$1200a8c0@gsicomp.on.ca> Subject: Re: [NOT] SOLVED: Problem with '-O -pipe' showing up in CFLAGS / CXXFLAGS Date: Sat, 18 Aug 2001 23:46:52 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Aargh! Further investigation would indicate that the problem is even deeper -- it's in bsd.port.mk where CFLAGS and CXXFLAGS get seeded with the default values provided by make. Does anyone know how to turn off make's defaults, aside from manually setting CFLAGS= in the environment? -- Matt Emmerton ----- Original Message ----- From: "Matthew Emmerton" To: ; Sent: Saturday, August 18, 2001 11:30 PM Subject: SOLVED: Problem with '-O -pipe' showing up in CFLAGS / CXXFLAGS > 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-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message