开发者

Creating debug build of autotools' build source

开发者 https://www.devze.com 2023-01-27 03:02 出处:网络
Given: source tar.gz AFAIK,开发者_JAVA百科 configure does support debug build (configure --help doesn\'t show --enable-debug)

Given:

  • source tar.gz
  • AFAIK,开发者_JAVA百科 configure does support debug build (configure --help doesn't show --enable-debug)

Questions:

  • Is it safe to use debug build if the authors of the package didn't supplied it in the first place?
  • If the answer to pre.v question is yes, than how I can produce debug build? Should I patch configure.ac?

Thanks


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.


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消