[WIP] Compiling and Installing from Sources [A Guide]

Status
Not open for further replies.

naveenchandran

In the zone
[WIP] Compiling Sources [A Complete Guide] :D

Usually for any linux applciations there are sources.
You can normally compile these souces and install on any distribution.

Most of the Applications Sources are provided as tarball's

So after getting the tarball you need to extract it...

If the tarball ends with .tar.gz then you have to extract it with command something like

Code:
tar xvzf some_application-0.1.3.tar.gz

If the tarball ends with .tar.bz2 then you have to extract it with command something like

Code:
tar xvjf some_application-0.1.3.tar.bz2


Now "some_application" will be extracted into a directory some_application-0.1.3

Now go into that directory [cd some_application-0.1.3]

Code:
./configure

This builds a new Makefile. The only generic options you are likely to use are the `--prefix' and `--exec-prefix' options. These options are used to specify the installation directory.

The default for `--prefix' is `/usr/local'. The default for `--exec-prefix' is the value used for `--prefix'.

Code:
./configure --prefix=/path

you should substitute /path with the prefix into which you want to install
the application.

After running `configure', you can build the tools by running `make'.
Code:
make

To install the tools, run `make install'.
Code:
make install
Installing the tools will copy the programs and any required support files to the installation directory. The location of the installation directory is controlled by `configure' options


To Summarize...

a) Extract the tarball
b) ./configure --prefix=/path
c) make
d) su
e) make install



Usually there will be a file named "INSTALL" in the directory. Read that first.

This should install the required application...



Some things to know...

Environment Variables

To list the current values of all environment variables, issue the command

Code:
env


PKG_CONFIG_PATH

A colon-separated (on Windows, semicolon-separated) list of directories to search for .pc files. The default directory will always be searched after searching the path; the default is libdir/pkgconfig:datadir/pkgconfig where libdir is the libdir where pkg-config and datadir is the datadir where pkg-config was installed.


LD_LIBRARY_PATH

The LD_LIBRARY_PATH environment variable contains a colon-separated list of directories in which the linker will search for library (.a) files.


[WIP] :arrow:

Plz do comment on this for any changes and additions to make this a better guide.
TO DO: Common errors while Compiling and Installing..
-- NC -- :D

Edited: Should be SU while installing | Thanks to desertwind
 

desertwind

Cyborg Agent
Naveen, good guide for newbies. One correction.

You need to root before installation of package, so the procedure is as follows.

a) Extract the tarball
b) ./configure --prefix=/path
c) make
d) su
give root password
d) make install

Also I suggest to use sourceinstall for installing from source for newbies. It is a GTK2 tool which provides a better way to manage configure options, directories and environment variables. Using it you can install, upgrade or remove a package.

Two screeshots attached.

*img100.imageshack.us/img100/8620/screenshotgnusourceinstaller6o.th.png

*img100.imageshack.us/img100/7735/screenshot9xh.th.png
 

praka123

left this forum longback
hmm...desertwind..there already is Checkinstall which will make .rpm .deb or any such for easy install.
 
Status
Not open for further replies.
Top Bottom