Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Aug 2010 10:08:39 -0400
From:      Greg Larkin <glarkin@FreeBSD.org>
To:        Roland Smith <rsmith@xs4all.nl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Setting Debug flag in /etc/make.conf
Message-ID:  <4C56D167.5000503@FreeBSD.org>
In-Reply-To: <20100802133831.GA88816@slackbox.erewhon.net>
References:  <20100801072824.0a3989bf@scorpio> <20100802133831.GA88816@slackbox.erewhon.net>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roland Smith wrote:
> On Sun, Aug 01, 2010 at 07:28:24AM -0400, Jerry wrote:
>> I have been having problems with several different programs lately.
>> Would there be any serious drawback to simply setting: "WITH_DEBUG= "
>> in the /etc/make.conf file to force everything I build/rebuild to be
>> built with debug symbols? 
> 
> No.
> 
> You are assuming every program's Makefile uses WITH_DEBUG that way!  The base
> system doesn't for one. And neither do all ports. To look for yourself, use
> the following command;
> 
>     find /usr/ports/ -type f -name Makefile -exec grep -H DEBUG {} \;
> 
> While a lot use WITH_DEBUG, not all ports do, and some use other options, like
> NODEBUG or DEBUGFLAGS, or DEBUGGING.
> 
> You'd have to look into the programs in question to see how to enable
> debugging for those.
> 
> Roland

WITH_DEBUG has special meaning in the ports infrastructure, and as long
as a specific port uses CFLAGS during compilation, it will be compiled
with debugging symbols when WITH_DEBUG is enabled.  Some ports also
check the value of WITH_DEBUG within their own Makefile in order to set
port-specific debug build options.

See this excerpt from /usr/ports/Mk/bsd.port.mk:

# WITH_DEBUG     - If set, debugging flags are added to CFLAGS and the
#                  binaries don't get stripped by INSTALL_PROGRAM.
#                  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.

Just put the following in /etc/make.conf and then recompile the ports
you want to include debug symbols:

WITH_DEBUG=	yes

Hope that helps,
Greg
- --
Greg Larkin

http://www.FreeBSD.org/           - The Power To Serve
http://www.sourcehosting.net/     - Ready. Set. Code.
http://twitter.com/sourcehosting/ - Follow me, follow you
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFMVtFn0sRouByUApARAvlbAKDKwV2anUR87ShERsHVsCpidSof5wCgtb8U
27W9F1G2DmKiebrDrgCe+0c=
=Xhvf
-----END PGP SIGNATURE-----




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C56D167.5000503>