skip to main | skip to sidebar
Showing posts with label configure. Show all posts
Showing posts with label configure. 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: , , , , ,

Monday, October 02, 2006

Compiling KDevelop from sources

Kdevelop is an IDE for KDE for various programming languages. I use it primarily for C++. It's very pleasant to use and it's also integrated with QDesigner for visually build graphical user interfaces.


Since I like to use the new features, I don't rely on the pre-built packages: I compile it from the svn sources, and in particular I'm using the currently developed 3.4 release. However, I also keep a working copy of the currently stable version 3.3.4; for this reason I install the version taken from svn in a different directory.

At first I had some problems in this process, so I report here my experience in successfully build and install kdevelop in a different directory. In particular, the following instructions assume that you want to install the compiled version in $HOME/usr/local. In case you want to install it in a different directory, all you need to change is this value.

First of all, I followed the instructions found at the web site (for downloading the sources from svn).

Then I run configure as follows (for $KDEDIR/share/doc/kde/HTML/en/kdelibs-apidocs/, please see the
instructions in the above web page):


./configure LD_LIBRARY_PATH=$HOME/usr/local/lib:$LD_LIBRARY_PATH
LIBRARY_PATH=$HOME/usr/local/lib:$LIBRARY_PATH --prefix=$HOME/usr/local
--with-kdelibsdoxy-dir=$KDEDIR/share/doc/kde/HTML/en/kdelibs-apidocs/
--disable-ada --disable-bash --disable-fortran --disable-haskell
--disable-java --disable-pascal --disable-perl

Of course, you can choose all the --disable options you like.

Then you can run make to compile the sources, and finally make install to install the compiled version (of course if you're installing in a system directory, then you might need to have the required privileges).

When you want to run this version of kdevelop you must use some environment variables. Here's how I run it (of course you can put this command line in a shell script):

LD_LIBRARY_PATH=$HOME/usr/local/lib:$LD_LIBRARY_PATH
LIBRARY_PATH=$HOME/usr/local/lib:$LIBRARY_PATH
KDEDIRS=$HOME/usr/local:$KDEDIRS
$HOME/usr/local/bin/kdevelop

Now you should be able to enjoy all the nice features of kdevelop :-)

Pubblicato da betto a 7:28 PM 1 commenti

Etichette: , ,

Subscribe to: Comments (Atom)
 

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