Destination Unknown

블로그 이미지
quantized
무무랭

Article Category

분류 전체보기 (85)
daily life (16)
reading (22)
scrap (25)
study (21)

Recent Trackback

Calendar

«   2008/08   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
  • Total27,964
  • Today7
  • Yesterday14
  • You run configure (you usually have to type ./configure as most people don't have the current directory in their search path). This builds a new Makefile.
  • Type make This builds the program. That is, make would be executed, it would look for the first target in Makefile and do what the instructions said. The expected end result would be to build an executable program.
  • Now, as root, type make install. This again invokes make, make finds the target install in Makefile and files the directions to install the program.

The configure, make, make install chain

All the software in the software map is generically built with the following instructions:

configure, make, make install

which should be familiar to OpenSource afficionados.

configure:
generates Makefiles required for a build and performs various configuration actions (setting an install path, setting #defined variables, deciding which source files to compile, checking for various systems libraries and functions etc). Invocations of configure are further controlled by additional shell variables and command line switches which fall into 3 general classes:
Enabling and disabling features
type command line arguments. These are intended to generally enable various features that autoconf cannot detect for itself. The feature is a placeholder for the actual feature, and can have additional arguments. For example to enable a scalar build one would use the command line argument:

--enable-parallel-arch=scalar

where the parallel-arch is the feature and has one argument scalar. Not all features have arguments. For example to enable SSE2 optimisations to QDP++ one would use the command line argument

--enable-sse2

Specifying packages
is generally used to specify the usage of an auxiliary package (such as say libxml2). Again these can take arguments like the --enable-feature switches. An example use is to specify to QDP++ the location of the installed libxml2 library:

--with-libxml2=/usr/local

Environment variables
can be used to give various pieces of information to the build system. One example of this is setting optimisation flags for a compiler. These can in principle differ from one compiler to the other or you may wish a build that enables debugging etc. Also if you want to link against a library which is not supported by -with-package options, you can use these to set the include and linker paths to your library (eg when using gmp). Typically the variables CFLAGS, CXXFLAGS, LDFLAGS and LIBS are set this way, to control compiler behaviour as the default autoconf settings are often dumb/non-existent. An example command line is:
configure CXXFLAGS="-O2 -finline-limit=50000 -I/home/foo/gmp/include" \
CFLAGS="-O2" LDFLAGS="-L/home/foo/gmp/lib" LIBS="-lgmp" --enable-gmp
which shows how to specify the flags to enable the GMP library installed in /home/foo/gmp. (This should be changed to a suitable -with-gmp option but that is for the future.)

make:
Builds the libraries and applications (if any)

make install
Installs the libraries


$ ./configure

The above command makes the shell run the script named ' configure ' which exists in the current directory. The configure script basically consists of many lines which are used to check some details about the machine on which the software is going to be installed. This script checks for lots of dependencies on your system. For the particular software to work properly, it may be requiring a lot of things to be existing on your machine already. When you run the configure script you would see a lot of output on the screen , each being some sort of question and a respective yes/no as the reply. If any of the major requirements are missing on your system, the configure script would exit and you cannot proceed with the installation, until you get those required things.

The main job of the configure script is to create a ' Makefile ' . This is a very important file for the installation process. Depending on the results of the tests (checks) that the configure script performed it would write down the various steps that need to be taken (while compiling the software) in the file named Makefile.

If you get no errors and the configure script runs successfully (if there is any error the last few lines of the output would glaringly be stating the error) then you can proceed with the next command which is

$ make

' make ' is actually a utility which exists on almost all Unix systems. For make utility to work it requires a file named Makefile in the same directory in which you run make. As we have seen the configure script's main job was to create a file named Makefile to be used with make utility. (Sometimes the Makefile is named as makefile also)

make would use the directions present in the Makefile and proceed with the installation. The Makefile indicates the sequence, that Linux must follow to build various components / sub-programs of your software. The sequence depends on the way the software is designed as well as many other factors.

The Makefile actually has a lot of labels (sort of names for different sections). Hence depending on what needs to be done the control would be passed to the different sections within the Makefile Or it is possible that at the end of one of the section there is a command to go to some next section.

Basically the make utility compiles all your program code and creates the executables. For particular section of the program to complete might require some other part of the code already ready, this is what the Makefile does. It sets the sequence for the events so that your program does not complain about missing dependencies.

One of the labels present in the Makefile happens to be named ' install ' .

If make ran successfully then you are almost done with the installation. Only the last step remains which is

$ make install

As indicated before make uses the file named Makefile in the same directory. When you run make without any parameters, the instruction in the Makefile begin executing from the start and as per the rules defined within the Makefile (particular sections of the code may execute after one another..thats why labels are used..to jump from one section to another). But when you run make with install as the parameter, the make utility searches for a label named install within the Makefile, and executes only that section of the Makefile.

The install section happens to be only a part where the executables and other required files created during the last step (i.e. make) are copied into the required final directories on your machine. E.g. the executable that the user runs may be copied to the /usr/local/bin so that all users are able to run the software. Similarly all the other files are also copied to the standard directories in Linux. Remember that when you ran make, all the executables were created in the temporary directory where you had unzipped your original tarball. So when you run make install, these executables are copied to the final directories.

Thats it !! Now the installation process must be clear to you. You surely will feel more at home when you begin your next software installation.
Trackback 0 and Comment 0
prev Prev : [1] ... : [28] : [29] : [30] : [31] : [32] : [33] : [34] : [35] : [36] ... : [85] : Next next