From owner-freebsd-questions Sat Aug 18 20:37:11 2001 Delivered-To: freebsd-questions@freebsd.org Received: from tomts5-srv.bellnexxia.net (tomts5.bellnexxia.net [209.226.175.25]) by hub.freebsd.org (Postfix) with ESMTP id EC71D37B407; Sat, 18 Aug 2001 20:37:02 -0700 (PDT) (envelope-from matt@gsicomp.on.ca) Received: from xena.gsicomp.on.ca ([64.228.155.124]) by tomts5-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20010819033702.RFJZ10424.tomts5-srv.bellnexxia.net@xena.gsicomp.on.ca>; Sat, 18 Aug 2001 23:37:02 -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 f7J3YPc74362; Sat, 18 Aug 2001 23:34:26 -0400 (EDT) (envelope-from matt@gsicomp.on.ca) Message-ID: <001701c1285f$3c4a48f0$1200a8c0@gsicomp.on.ca> From: "Matthew Emmerton" To: , Subject: SOLVED: Problem with '-O -pipe' showing up in CFLAGS / CXXFLAGS Date: Sat, 18 Aug 2001 23:30:03 -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 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