Debugging ports

Guido Falsi mad at
Tue Oct 17 21:11:46 UTC 2017

On 10/17/2017 18:04, Piotr Kubaj via freebsd-ports wrote:
> Hi all,
> I am preparing a new port. However, I hit an assertion fail when 
> starting the binary. The developer is willing to help me, provided that 
> I send him backtrace and values from the structure that hits assertion 
> failure.
> Thing is, recompiling with WITH_DEBUG doesn't help (I only get memory 
> addresses in gdb), nor does -DCMAKE_BUILD_TYPE=Debug to CMAKE_ARGS (the 
> port uses CMake).
> What should I do to get necessary date?
You should add "WITH_DEBUG=yes" in your make.conf file, then recompile 
any port in which you need debugging symbols. It will automatically 
disable optimizations, add -g to CFLAGS and add many other common knobs 
for any port. Most ports needing special care to get debugging binaries 
have extra directives in their Makefiles, enabled by that same flag.

Be aware that compiling a debugging version requires more memory than a 
normal version, for big ports it could get REALLY big. I was not able to 
compile a debugging version of llvm40 with 16 GiB RAM (one poudriere 
jail using make jobs, maybe without parallelization it could be done).

If you're using poudriere to build a whole set of ports you could use 
something like this (verbatim from my machine):


.if ${.CURDIR:M*lang/ruby*} || ${.CURDIR:M*devel/llvm*} || 
${.CURDIR:M*lang/gcc*} || ${.CURDIR:M*devel/gdb*} || 

(obviously I'm not debugging any of those which are quite memory hungry 
when building debugging versions, but I'm debugging other things 
depending on them)

Hope this helps.

Guido Falsi <mad at>

More information about the freebsd-ports mailing list