Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Mar 2017 23:40:45 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Mark Millard <markmi@dsl-only.net>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: FYI: what it takes for RAM+swap to build devel/llvm40 with 4 processors or cores and WITH__DEBUG= (powerpc64 example)
Message-ID:  <7FFF80B9-CE74-49C8-B295-DCB630368152@FreeBSD.org>
In-Reply-To: <D0E5EBD5-F050-407C-B57B-B0630090BB4F@dsl-only.net>
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> <F73D89C4-4E7F-469E-8613-17427231E5C0@FreeBSD.org> <D0E5EBD5-F050-407C-B57B-B0630090BB4F@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <markmi@dsl-only.net> wrote:
>=20
> On 2017-Mar-27, at 5:53 AM, Dimitry Andric <dim at FreeBSD.org> wrote:
>> On 27 Mar 2017, at 12:25, Mark Millard <markmi at dsl-only.net> =
wrote:
>>>=20
>>> On 2017-Mar-27, at 2:41 AM, Dimitry Andric <dim@FreeBSD.org> wrote:
>>>> On 26 Mar 2017, at 23:36, Mark Millard <markmi@dsl-only.net> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7FFF80B9-CE74-49C8-B295-DCB630368152>