Setting Debug flag in /etc/make.conf

Greg Larkin glarkin at FreeBSD.org
Mon Aug 2 14:18:52 UTC 2010


-----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-----



More information about the freebsd-questions mailing list