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.
But it's not too late to start writing now. :) write down the problems encountered in compilation and solutions, and 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 source code compilationBasic Method
And several important files and important variables in the source code compilation process
Pkg_config_path
In the forum, it is often seen that some people fail to compile the source code.
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 gtk316-2.4.13.tar.bz2
Unbind source code package
Cd gtk +-2.4.13/
Go to the source code directory
./Configure
It seems that in some environments,./configure may cause terminal exit.
And use. Configure
It will run normally. If this happens, try again.. Configure
You can use the configure program to guess the host information and create a makefile to complete make. If./configure is not successful
But if you go to make, it will appear"Make: *** no targets specified and no makefile found. Stop ."
Make
After./configure is successfully completed, the program will be officially compiled.
Make install
Use make install to install
Make uninstall
Some software can be detached.,
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
View Details, usually in front of the General configure
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 code package is usually stored in/Usr/local
Lower
Because this isFHS (filesystem Hierarchy Standard)
What is FHS? Let's take a look at this article:
Http://www.pathname.com/fhs/pub/fhs-2.3.html
I believe it will give you a better understanding of the Linux system structure and 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 library files, so you do not need to setPkg_config_path
(Description 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:Man ldconfig
Check
Simply put, its roleCache 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
So that all library files are cached in LD. So. cache. If not,Even if the library file is clearly under/usr/lib, it will not be used.
, Result
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 does GTK +-2.4.x still prompt 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, in the above section,The glib-2.4.x was not found and prompted that the glib-2.0.pc should be added to pkg_config_path.
Exactly thisPKG-config pkg_config_path glib-2.0.pc
What is it? Let me tell you have _^
First, let's talk about how it came out.Pkgconfig-x.x.x
After this package, there will be morePKG-config
, It is neededPkg_config_path
Dongdong
What is pkgconfig-x.x.x? Here is a description:
The pkgconfig package contains
ToolsPassing 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_pathIs 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, suchThe software version, the Library version, and the library path.
, Etc.
The information is only inUse during compilation
. You canLs/usr/lib/pkgconfig
You will see a lot of *. PC, open it in a text editor
You will find information similar to the following:
Prefix =/usr
Exec_prefix =$ {prefix}
Libdir =$ {exec_prefix}/lib
Includedir =$ {prefix}/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 ${libdir}-lglib-2.0
Cflags:-I $ {includedir}/glib-2.0-I $ {libdir}/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
/Usr/local/lib/pkgconfig
To add the pathPkg_config_path
Next.And make sure that configure finds the correct
Glib-2.0.pc
That is, the other lib/pkgconfig directory glib-2.0.pc is killed. (If yes, ^-^)
Can be added~ /. 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
As shown above,When installing the library file, it is very good to specify the installation to/usr, whether it is/etc/lD. So. conf or pkg_config_path
By default, the/usr/lib
, Can save a lot of trouble, but from the source package management, are installed under/usr
Management is a problem. It is better to install it in/usr/local for convenient management.
In fact, you only need to set lD. So. conf, pkg_config_path
After path,
Okay! ^_^
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 wrong position, such as displayXXXX. h no such file or directory
Header file 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.
Ii. during compilation, you can use&&
Connection command,&&
Indicates 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
ChangLog :
05/02/06:
"CDROM. h: 20: 23: SD" appears during dosbox compilation.
L_sound.h: no such file or directory"
Today, I suddenly wanted to review the Typical DoS game, so I compiled this dosbox simulator. In README, I described the need for sdl_sound.
So download and install, very smooth, not specified
Fixed installationPath, so the default installation to/usr/local/
When compiling dosbox make, the following error occurs:
If G ++-dhave_config_h-I.-I.-I.../...-I..././include
-I/usr/include/SDL-d_reentrant-March = pentium4-O3-pipe
-Fomit-frame-pointer-MT dos_programs.o-MD-MP-MF
". Deps/dos_programs.tpo"-c-o dos_programs.o dos_programs.cpp ;/
Then MV-F ". deps/dos_programs.tpo" ". deps/dos_programs.po"; else Rm-F ". deps/dos_programs.tpo"; Exit 1; FI
In file encoded ded from dos_programs.cpp: 30:
CDROM. h: 20: 23: sdl_sound.h: no such file or directory <------ the cause of the error is here
In file encoded ded from dos_programs.cpp: 30:
CDROM. h: 137: Error: iso c ++ forbids declaration of 'sound _ sample' with no type
CDROM. h: 137: Error: Expected '; 'before' *' token
Make [3]: *** [dos_programs.o] Error 1
Make [3]: Leaving directory '/root/software/dosbox-0.63/src/DOS'
Make [2]: *** [All-recursive] Error 1
Make [2]: Leaving directory '/root/software/dosbox-0.63/src'
Make [1]: *** [All-recursive] Error 1
Make [1]: Leaving directory '/root/software/dosbox-0.63'
Make: *** [all] Error 2
[Root @ newlfs dosbox-0.63] #
It seems that the header file "sdl_sound.h" is not found in CDROM. h.
So the following error occurs, but I have installed sdl_sound?
After searching, sdl_sound.h is found under/usr/local/include/SDL /.
It seems that dosbox does not search for the header file under/usr/local/include/SDL. It is easy to solve the problem after finding the cause.
[Root @ newlfs dosbox-0.63] # ln-S/usr/local/include/SDL/sdl_sound.h/usr/include
Link to/usr/include, so that the dosbox can be found and compiled successfully.
Once compiled Xorg-6.8.1, also appeared to be unable to find FreeType. h problem, the reason is also so.
When compiling and installing software, you may encounter similar situations because you cannot find the required header file.
No relevant header file is installed or is installed but not found, as shown in the preceding example.
If you cannot find it, make a link to/usr/include.
Not Installed: go to Google to find something including this header file, and install it.
Generally, the error message is "no such file or directory", so you should look for the error message when compilation fails.
The error message is always not far from the error. Be patient. ^_^
Do not modify/etc/lD. So. conf to use the library file in a non-default path ----- LD_LIBRARY_PATH
The environment variable LD_LIBRARY_PATH lists the paths except the default path when searching for shared libraries.
If you do not want to modify or cannot modify (without root permission)/etc/lD. So. conf, use the library files in other paths
You need to set LD_LIBRARY_PATH, for example, export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/opt/lib
In this way, you can use the library files under/opt/lib. Of course, it is convenient to modify/etc/lD. So. conf.
Write it here first, then compile your thoughts and then add ^_^.
URL: http://mengxin.bokee.com/686193.html