skip to main | skip to sidebar
Showing posts with label automake. Show all posts
Showing posts with label automake. Show all posts

Tuesday, December 19, 2006

C/C++ parameters at configure time

If you ever compiled an open source program from sources, you'll surely know the sequence:

./configure
make
make install

In particular, the first command will try to figure out the system you're using for compilation and to set some parameters accordingly (C and C++ compiler, missing features, etc.). This script is usually automatically built using the GNU Autotools, such as autoconf, automake, libtool.

The configure usually assume the following parameters for the C/C++ compiler:

-g -O2

That is, enable debugger information, and perform optimizations and for the end user this might be OK.

However, for the developer, who probably will have to debug the program, having the optimizations enabled might make debugging a nightmare (since some instructions might be rearranged by the optimizer). For this reason, I usually disable optimizations at configuration time simply by using the following configure command line:

./configure CXXFLAGS="-g" CFLAGS="-g"

So that debugging will be much easier!

Pubblicato da betto a 2:06 PM 0 commenti

Etichette: , , , , ,

Subscribe to: Posts (Atom)
 

AltStyle によって変換されたページ (->オリジナル) /