From owner-freebsd-ports@freebsd.org Mon Mar 27 21:40:57 2017 Return-Path: Delivered-To: freebsd-ports@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 1D2BDD20348; Mon, 27 Mar 2017 21:40:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D469A6A; Mon, 27 Mar 2017 21:40:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::5868:2545:a766:52d] (unknown [IPv6:2001:470:7a58:0:5868:2545:a766:52d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 9C5801F9A6; Mon, 27 Mar 2017 23:40:52 +0200 (CEST) From: Dimitry Andric Message-Id: <7FFF80B9-CE74-49C8-B295-DCB630368152@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_514FBD21-D9EF-4E52-B92E-56F9D9059F6B"; protocol="application/pgp-signature"; micalg=pgp-sha1 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) Date: Mon, 27 Mar 2017 23:40:45 +0200 In-Reply-To: Cc: FreeBSD Ports , FreeBSD PowerPC ML , FreeBSD Toolchain , FreeBSD Current To: Mark Millard 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> X-Mailer: Apple Mail (2.3259) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2017 21:40:57 -0000 --Apple-Mail=_514FBD21-D9EF-4E52-B92E-56F9D9059F6B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 27 Mar 2017, at 23:11, Mark Millard wrote: >=20 > 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 >=20 > Interesting. WITH_DEBUG's description in the file does not > mention that stripping of optimization flags: >=20 > # 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. >=20 > I'll probably give myself an override that I can specify in > /etc/make.conf , such as: >=20 > # 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 Effectively, this gives some sort of support for three of CMake's build types, e.g: * Debug, which disables optimization, and obviously adds debuginfo * Release, which optimizes for speed, and does not add debuginfo * RelWithDebInfo, similar to Release but does add debuginfo It would be nice if there was some way of directly utilizing these. The RelWithDebInfo target is very useful with the LLVM projects. -Dimitry --Apple-Mail=_514FBD21-D9EF-4E52-B92E-56F9D9059F6B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAljZhuQACgkQsF6jCi4glqMorQCgv/7IBqz9jGgFaN9QHYfyAdbR KxEAn0lOODsBULR/lK+hU1IIgZzVItti =v4EU -----END PGP SIGNATURE----- --Apple-Mail=_514FBD21-D9EF-4E52-B92E-56F9D9059F6B--