There are also some defects in it, because of the time in a hurry, there is time to make changes.
Information Source: http://bluesilence.blogchina.com/
First glib
The second ATK
Third Cairo
Fourth pango
(The installation command is./configure -- prefix =/usr & make install)
Fifth GTK
When installing GTK parameters reference http://www.gtk.org (./configure -- prefix =/opt/GTK)
After installing GTK, copy GTK +-2.0.pc to/usr/lib/pkgconfig.
Download Cairo
Http://cairographics.org/snapshots/LATEST-cairo-0.9.2
Download GTK-related installation software
Http://www.gtk.org
Pango installation path:
By default, the installation in/usr/local does not work for pango,
This is comprehensive./configure -- prefix =/usr -- libdir =/usr/lib -- sysconfdir =/etc
Note: when compiling the first example
GCC base. C-o base 'pkg-config -- cflags -- libs GTK +-2.0'
Note that the single quotation mark type used in the preceding compilation command is very important. (Note: "command replacement" is used here ". Command substitution allows you to capture the output of a command and replace it with another command. This single quotation mark is not the one on the left of the Enter key, but the one under the ESC key .)
Changelog:
05/02/06: the header file cannot be found during dosbox make compilation. Similar errors have been encountered. Record. :)
The role of LD_LIBRARY_PATH.
It is not easy to compile and install Dongdong from the source code. Before using LFS, the source code compilation and installation software has never
If you have succeeded or even encountered an error, you have to give up.
After the baptism of LFS, I finally had a little understanding of source code compilation and installation. Unfortunately, I didn't write down these experiences at the beginning.
However, it is not too late to write down the problems encountered in the compilation and the solutions, so as to accumulate experience,
Newbie can also learn about the source code installation software and have more chances of success. After all, it can be compiled from the source code package.
^_^
Let's talk about the basic methods of source code compilation and several important files and important variables in the source code compilation process.
Pkg_config_path setting. It is often seen in the forum that some people fail to compile the source code, which is a ghost of this stuff.
How to install software from the source code package?
The most important thing to install software from the source code package is to carefully read the instructions such as readme install.
It will tell you how to successfully install
The steps for installing software from the source code package are as follows:
Tar jxvf gtk0000-2.4.13.tar.bz2 unbind the source code package
Cd gtk +-2.4.13/enter the source code directory
./Configure seems to be in some environments./configure will cause terminal exit
Using. Configure will run normally. If this happens, try. Configure.
You can use the configure program to guess the host information and create a makefile to complete make. If./configure is not successful
When you go to make, "Make: *** no targets specified and no makefile found. Stop ."
Make starts to compile the program after./configure is successfully completed.
Use make install to install
Make uninstall some software supports uninstallation. This method may be used for uninstallation. If it is supported, it is usually written in readme (it seems that it is relatively small)
The Configure program has many parameters. You can use./configure -- help to view the details.
Parameter description, followed by the description of available parameters of the program.
./Configure -- prefix =/usr specifies the installation directory. The software compiled and installed from the source package is usually stored under/usr/local by default.
Because this is the FHS (filesystem Hierarchy Standard) rule, do not know what is FHS? Let's take a look at this article:
Http://www.pathname.com/fhs/pub/fhs-2.3.html believes it will give you a better understanding of the Linux system structure, it is worth reading.
Let's talk about a few things related to successful compilation:/etc/lD. So. conf ldconfig pkg_config_path
First, describe/etc/lD. So. conf:
This file records the path of the dynamic link library used during compilation.
By default, the compiler only uses the library files in the/lib and/usr/lib directories.
If you have installed some libraries, for example, when installing GTK +-2.4.13, it will require glib-2.0> = 2.4.0.
-- Prefix =/usr is not specified, so the glib library is installed under/usr/local, and/usr/local/lib is not added to/etc/lD. So. conf.
This search path causes an error when compiling GTK +-2.4.13.
There are two solutions to this problem:
A: When compiling the glib-2.4.x, specify the installation to/usr, so that the library file will be placed in/usr/lib, GTK will not find the required Library File
This is a good method for installing the library file, so you do not need to set pkg_config_path (described later)
2. Add/usr/local/lib to/etc/lD. so. conf. Then, when installing GTK, you will search for/usr/local/lib and find the required library.
Adding/usr/local/lib to/etc/lD. So. conf is also required. In this way, the problem will not occur when you install Dongdong to local.
It is wise to add the paths that may store the library files to/etc/lD. So. conf. ^_^
The addition method is extremely simple. It is okay to directly write the absolute path of the library file into it, one line at a time. For example:
/Usr/x11r6/lib
/Usr/local/lib
/Opt/lib
Let's take a look at what ldconfig is like:
It is a program, usually located under/sbin, which is used by the root user. The specific functions and usage can be found in man ldconfig.
To put it simply, it caches the library files in the paths listed in/etc/lD. So. conf to/etc/lD. So. cache for use.
Therefore, after installing some library files (such as just installed Glib), or modifying lD. So. conf to add a new library path, run/sbin/ldconfig
Make all the library files cached in LD. So. cache. If it is not done, it will not be used even if the library file is clearly under/usr/lib.
During the compilation process, I encountered an error and lacked the xxx library. I found that the library was clearly there. I wanted to yell at computer pig. Pai_^
I once made this mistake when compiling KDE (it needs to be run once every compilation of a good stuff), so
Remember to run ldconfig after modifying the library file, and run it in any directory.
Let's talk about the variable pkg_config_path:
I often see someone asking on the Forum, "Why have I installed the glib-2.4.x, But compiling GTK +-2.4.x still prompts that the glib version is too low?
Why did I install the glib-2.4.x, or did I prompt that a?... could not be found ?...... "It's all about this variable.
First, let's take a look at the errors that occur during the compilation process (compile GTK +-2.4.13 ):
Checking for PKG-config.../usr/bin/PKG-config
Checking for glib-2.0> = 2.4.0 ATK> = 1.0.1 pango> = 1.4.0... package glib-2.0 was not found in the PKG-config search path.
Perhaps you shoshould Add the directory containing 'glib-2.0.pc'
To the pkg_config_path environment variable
No package 'glib-2.0 'Found
Configure: Error: library requirements (glib-2.0> = 2.4.0 ATK> = 1.0.1 pango> = 1.4.0) not met; consider adjusting the pkg_config_path environment variable if your libraries are in a nonstandard prefix so PKG-config can find them.
[Root @ newlfs GTK +-2.4.13] #
Obviously, the above section shows that no glib-2.4.x is found and prompts that the glib-2.0.pc should be added to pkg_config_path.
What exactly is this PKG-config pkg_config_path glib-2.0.pc doing? Let me tell you have _^
First talk about where it came out, when the installation of the pkgconfig-x.x.x package, it is more PKG-config, it is the need for pkg_config_path stuff
What is pkgconfig-x.x.x? Here is a description:
The pkgconfig package contains tools for passing the include path and/or library paths to build tools during the make File Execution.
PKG-config is a function that returns meta information for the specified library.
The default setting for pkg_config_path is/usr/lib/pkgconfig because of the prefix we use to install pkgconfig. you may add to pkg_config_path by exporting additional paths on your system where pkgconfig files are installed. note that pkg_config_path is only needed when compiling packages, not during Run-Time.
After reading this instruction, you probably know what it is.
In fact, PKG-config is a program that provides system information to the configure program, such as the software version, library version, library path, and so on.
This information is only used during compilation. You can see a lot of *. PC under ls/usr/lib/pkgconfig and open it in a text editor.
You will find information similar to the following:
Prefix =/usr
Exec_prefix = $
Libdir = $/lib
Includedir = $/include
Glib_gen1_al = glib-gen1_al
Gobject_query = gobject-Query
Glib_mkenums = glib-mkenums
Name: glib
Description: C utility Library
Version: 2.4.7
Libs:-L $-lglib-2.0
Cflags:-I $/glib-2.0-I $/glib-2.0/include
See, configure depends on the information to determine whether your software version meets the requirements. And get the location where these things are located, or where to find them.
I don't need to say that you also know why the above problems have occurred.
The solution is simple, set the correct pkg_config_path, if the glib-2.x.x is mounted to/usr/local/, then the glib-2.0.pc will
Under/usr/local/lib/pkgconfig, add this path to pkg_config_path. And make sure that configure finds the correct
Glib-2.0.pc, is to take the other lib/pkgconfig directory glib-2.0.pc is killed. (If yes, ^-^)
After setting, you can add it ~ /. Bashrc, for example:
Pkg_config_path =/opt/kde-3.3.0/lib/pkgconfig:/usr/local/pkgconfig:
/Usr/x11r6/lib/pkgconfig
[Root @ newlfs ~] # Echo $ pkg_config_path
/Opt/kde-3.3.0/lib/pkgconfig:/usr/local/pkgconfig:/usr/x11r6/lib/pkgconfig
It can be seen from the above that it is very good to specify the installation to/usr when installing the library file, whether it is/etc/lD. So. conf or pkg_config_path
By default,/usr/lib is searched, which saves a lot of trouble. However, in terms of source code package management
Management is a problem. It is better to install it in/usr/local for convenient management.
In fact, after you set the lD. So. conf and pkg_config_path paths, it will be OK. ^_^
Some other software, such as the emacs-21.3, cannot be compiled successfully under the gcc-3.4.x due to version reasons, (make error)
The GCC of earlier versions may be compiled.
It may be because of the great changes in gcc-3.3.x and gcc-3.4.x.
If you have thought so much about it for the time being, write it down first. If you have a little understanding of the source code package compilation, you will not waste me writing this word for so long. Pai_^
In addition, when the./configure is passed and make fails, it is difficult to solve such a problem. You can only find the cause based on experience. For example, a header file is not found,
At this time, you need to find an error along the line at the location where the error occurs. For example, if XXXX. h no such file or directory is displayed, the header file is missing.
Then go to Google to search.
Or find the error information that feels valuable and get Google to search for it, you will often find a solution. Let's take a closer look at readme and install
How to install the program, what dependent files are needed, and so on.
In addition, for newbie, it is often not known whether the compilation is successful or not, but if the compilation fails, make install
Errors are inevitable, increasing the complexity of solving the problem. You can check whether the compilation is successful using the following method:
1. After compilation, input echo $? If the returned result is 0, the result ends normally. Otherwise, an error occurs.
Echo $? Check the exit status of the previous command. If the program Exits normally, 0 is returned. If the program Exits normally, non-0 is returned.
2. During compilation, you can use the & connection command, & to indicate that "the current command ends normally and the subsequent command will be executed", that is, "and.
This method is good, that is, saving time and preventing errors. Example:
./Configure -- prefix =/usr & make install