dimba
dimba

Reputation: 27571

Creating debug build of autotools' build source

Given:

Questions:

Thanks

Upvotes: 11

Views: 8275

Answers (2)

chadadavis
chadadavis

Reputation: 331

You could define an alias that automatically sets the environment variables:

alias configuredebug='CPPFLAGS=-DDEBUG CFLAGS="-g -O0" CXXFLAGS="-g -O0" ./configure'

Upvotes: 2

dennycrane
dennycrane

Reputation: 2331

A properly crafted Autotools project supports user-supplied compiler and linker flags. Some authors choose to provide --enable-debug to simplify creation of debug builds, but its absence does not mean it cannot be done. The first thing I recommend you try is to specify compiler and linker flags that are suitable to your debugging needs. If you are using gcc on Linux, that could be

./configure CFLAGS="-ggdb3 -O0" CXXFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3"

It is recommended to specify the variables as parameters to configure, as shown, instead of as environment variables. By doing it this way, the Autotools will keep these settings when you make changes that trigger an automatic reconfiguration.

If that does not produce the desired result, yes, hacking the build system may be necessary.

Upvotes: 20

Related Questions