Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Mar 2017 14:11:49 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Dimitry Andric <dim@FreeBSD.org>
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:  <D0E5EBD5-F050-407C-B57B-B0630090BB4F@dsl-only.net>
In-Reply-To: <F73D89C4-4E7F-469E-8613-17427231E5C0@FreeBSD.org>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D0E5EBD5-F050-407C-B57B-B0630090BB4F>