Your Ad Here Your Ad Here
Results 1 to 4 of 4

Thread: Compiling Software

  1. #1
    Join Date
    Jan 2003
    Compiling Software

    First of all, most linux software is disributed in the form of "tarballs", this refers to the tar.gz or tar.bz2 extension. These archives usually contain a source tree, files and directors full of the source code that makes up a program.

    The example program I am going to use for this tutorial is aterm

    When you are finished downloading the tarball, you need to extract it. To extract a tarball, you use this command:

    tar -zxf (filename) (this command is used for files that are gziped, they usually contain a tar.gz extension)

    tar -jxf (filename) (this one is used for bziped files, they end in tar.bz2)

    When you run those commands it extacts the contents of the tarball into your current working directory.

    So the next thing you need to do is cd into the new directory with the source tree.

    cd aterm-0.4.2

    Yay, now you have to read the README and the INSTALL files, these have important information you need to know for installing, they usually contain some info about what you'll need to compile the program.

    Next we have to run ./configure, but first you should check ./configure --help to check if there are any options you want/don't want or if you need to specify a path to a library, etc. Piping the output to a pager like less is a good idea.

    ./configure --help | less

    Aterm has quite a bit of options to turn on and off

    Nothing that I want to change, so I just ran -


    loading cache ./config.cache
    configuring for aterm 0.4.2
    checking for gcc... gcc
    checking whether the C compiler (gcc -march=pentium3 -O3 -pipe -fomit-frame-pointer ) works... yes
    checking whether the C compiler (gcc -march=pentium3 -O3 -pipe -fomit-frame-pointer ) is a cross-compi
    ler... no
    checking whether we are using GNU C... yes
    checking whether gcc accepts -g... yes
    checking how to run the C preprocessor... gcc -E
    checking for a BSD compatible install... /usr/bin/ginstall -c
    checking for mv... /bin/mv
    checking for rm... /bin/rm
    checking for cp... /bin/cp
    checking for sed... /bin/sed
    checking for AIX... no
    checking for POSIXized ISC... no
    checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
    checking for dnet_ntoa in -ldnet... no
    checking for dnet_ntoa in -ldnet_stub... no
    checking for gethostbyname... yes
    checking for connect... yes
    The output should look similar to that.

    So, if ./configure goes well, the next thing you need to do is run make, this compiles the program, using the Makefile to tell it how to do things. The Makefile is created by ./configure.

    When you run make you should see output like this:

    gcc -DHAVE_CONFIG_H -DDEBUG_STRICT -c -I/usr/X11R6/include -I. -I.. -I. -march=pentium3 -O3 -pipe -fomit-frame-pointer command.c


    When your done compiling, you need to install the program. This is traditionally done by running the command 'make install', but I prefer using checkinstall, it takes the place of make install during the compiling process. Here are some features of checkinstall:

    CheckInstall will create a Slackware, RPM or Debian compatible package and install it with Slackware's installpkg, "rpm -i" or Debian's "dpkg -i" as appropriate, so you can view it's contents with pkgtool ("rpm -ql" for RPM users or "dpkg -l" for Debian) or remove it with removepkg ("rpm -e"|"dpkg -r"). Aditionally, this script will leave you a copy of the installed package in the source directory so you can install it wherever you want, which is my second motivation: I don't have to compile the same software again and again every time I need to install it on another box :-).
    If everything went well, you should have the program installed and ready to go.

    I hope this tutorial is complete enough, if anyone has anything to add, please post it.


    This section is about CFLAGS and CXXFLAGS (C and C++ Flags), these tell the compiler to run certain optimizations or options when compiling things.

    I'm no GCC guru so I won't try to explain it, so here are some links.

    Optimized gcc compiling
    GCC Myths and Facts
    GCC 3.2 flags

  2. Software & Hardware   -   #2
    shn's Avatar 3μ|\|(7
    Join Date
    May 2003

    ./configure --help is very useful.


    I almost forgot, you can also run "./" if there's one in the source. That creates a configure script so that you can run ./configure when their is'nt a configure script in the source.

  3. Software & Hardware   -   #3
    Join Date
    Jan 2003

    I never knew about the, that will come in handy

  4. Software & Hardware   -   #4
    shn's Avatar 3μ|\|(7
    Join Date
    May 2003
    Originally posted by LSA@17 May 2004 - 20:02

    I never knew about the, that will come in handy
    You'll mostly find it with cvs fav.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts