From owner-freebsd-current@freebsd.org Mon Mar 27 21:11:52 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BBC3D2093F for ; Mon, 27 Mar 2017 21:11:52 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-211-180.reflexion.net [208.70.211.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46FABE49 for ; Mon, 27 Mar 2017 21:11:52 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 16407 invoked from network); 27 Mar 2017 21:11:51 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 27 Mar 2017 21:11:51 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v8.30.2) with SMTP; Mon, 27 Mar 2017 17:11:51 -0400 (EDT) Received: (qmail 15521 invoked from network); 27 Mar 2017 21:11:50 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 27 Mar 2017 21:11:50 -0000 Received: from [192.168.1.111] (c-67-170-167-181.hsd1.or.comcast.net [67.170.167.181]) by iron2.pdx.net (Postfix) with ESMTPSA id 00D36EC81C9; Mon, 27 Mar 2017 14:11:49 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: FYI: what it takes for RAM+swap to build devel/llvm40 with 4 processors or cores and WITH__DEBUG= (powerpc64 example) From: Mark Millard In-Reply-To: Date: Mon, 27 Mar 2017 14:11:49 -0700 Cc: FreeBSD Ports , FreeBSD PowerPC ML , FreeBSD Toolchain , FreeBSD Current Content-Transfer-Encoding: quoted-printable Message-Id: References: <3EDEF0B7-59C5-4648-9737-6682E18645BC@dsl-only.net> <39C60316-F905-490D-B0AB-BC24D7F351A2@dsl-only.net> <7F94CE59-D2CC-4D6F-B1CD-FF3D1F8EDCE7@FreeBSD.org> <45E32F4F-A238-47AA-8E1E-7AD4D9E857D9@dsl-only.net> To: Dimitry Andric X-Mailer: Apple Mail (2.3259) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2017 21:11:52 -0000 On 2017-Mar-27, at 5:53 AM, Dimitry Andric wrote: > On 27 Mar 2017, at 12:25, Mark Millard wrote: >>=20 >> On 2017-Mar-27, at 2:41 AM, Dimitry Andric wrote: >>> On 26 Mar 2017, at 23:36, Mark Millard wrote: > ... >>>> Installed packages to be REMOVED: >>>> llvm40-4.0.0.r4 >>>>=20 >>>> Number of packages to be removed: 1 >>>>=20 >>>> The operation will free 49 GiB. >>>=20 >>> Yes, this is big. But there is no real need to build the llvm ports >>> with debug information, unless you want to hack on llvm itself. And >>> in that case, you are better served by a Subversion checkout or Git >>> clone from upstream instead. > ... >> Historically unless something extreme like this ends up >> involved I build everything using WITH_DEBUG=3D or explicit >> -g's in order to have better information on any failure. >=20 > The problem with the ports implementation of WITH_DEBUG is that it > always disables all optimizations, without a possibility to override. > Which bloats the resulting object files, libraries and executables, = and > especially so for large C++ projects such as LLVM. >=20 > I can recommend the following workaround. If you want to build a port > with optimizations disabled, you can always pass -O0 in CFLAGS. >=20 > -Dimitry >=20 > Index: Mk/bsd.port.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- Mk/bsd.port.mk (revision 436685) > +++ Mk/bsd.port.mk (working copy) > @@ -1646,7 +1646,7 @@ MAKE_ENV+=3D DONTSTRIP=3Dyes > STRIP_CMD=3D ${TRUE} > .endif > DEBUG_FLAGS?=3D -g > -CFLAGS:=3D ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} > +CFLAGS:=3D ${CFLAGS} ${DEBUG_FLAGS} > .if defined(INSTALL_TARGET) > INSTALL_TARGET:=3D ${INSTALL_TARGET:S/^install-strip$/install/g} > .endif Interesting. WITH_DEBUG's description in the file does not mention that stripping of optimization flags: # WITH_DEBUG - If set, debugging flags are added to CFLAGS = and the # binaries don't get stripped by INSTALL_PROGRAM = or # INSTALL_LIB. Besides, individual ports might # add their specific to produce binaries for = debugging # purposes. You can override the debug flags = that are # passed to the compiler by setting DEBUG_FLAGS. = It is # set to "-g" at default. I'll probably give myself an override that I can specify in /etc/make.conf , such as: # svnlite diff /usr/ports/Mk/bsd.port.mk Index: /usr/ports/Mk/bsd.port.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- /usr/ports/Mk/bsd.port.mk (revision 436747) +++ /usr/ports/Mk/bsd.port.mk (working copy) @@ -1646,7 +1646,11 @@ STRIP_CMD=3D ${TRUE} .endif DEBUG_FLAGS?=3D -g +.if defined(ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG) +CFLAGS:=3D ${CFLAGS} ${DEBUG_FLAGS} +.else CFLAGS:=3D ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} +.endif .if defined(INSTALL_TARGET) INSTALL_TARGET:=3D ${INSTALL_TARGET:S/^install-strip$/install/g} .endif =3D=3D=3D Mark Millard markmi at dsl-only.net