2009年1月7日星期三

linux software installation from source

There is a lot of package such as .deb, rpm in linux, but I prefer/have to install the software from source, since I can modify the source in the way I want, and I have also need to cross compile for embedded system.

The most generic way to install software from source, and it is easy
1. #./configure
./configure will generate makefile, header file, marco...etc base on the software installed
in the file system

2. #make
compile the source to executable binary with generated files

3.#make install
copy the executable, header file, library to the specific location in the file system.


The most common problem is in the configure and make process.
During configure, it may require another sw to be installed in the file system, but it fails.
The reason may be,
1. the sw is not yet install in the file system
2. the sw is intalled in the file system, but it can't be found during the ./configure

Solution to the first case is easy, you just get the source on the web, and do the ./configure,
make && make install, if no error, then it is done.

Solution to second case is a little bit complicated, since there could be a lot of reason that
./configure can't file the sw which is already install in the file system.m
For easy discussion, let assume software B require software A to be install in the file system.

1. sw A is not install in the default path for example, the default path may be /usr/a, however sw A is install in /home/usera/usr/a.

In this case, you need to check how to tell sw B during ./configure where is the sw A installed. usually an option "--with--sw_a=/path_to_sw_a"

Actually what is the path really does?
1. It provides header file to be included
2. It provides library for static or dynmaic linkage.

This steps can be done in one line,

# LDFLAGS=-Lpath_to_sw_a/?/lib CFLAGS=-Ipath_to_sw_a/?/include ./configure --with_sw_a=/path_to_sw_a

沒有留言:

發佈留言