Linux in the use of RPM format program package to install is a convenient way, but a part of the program package does not have the RPM package format, it is necessary for users to manually compile the source package to install. The text mainly explains the source code compiles the principle and the basic operation process.
Source Package Naming method
Name-version. Tar. Gz
Where: VERSION = Major. Minor. Release
Major represents the major version number, after a relatively large improvement
Minor indicates minor version number, improvement is relatively small
Release indicates fixes for some bugs
Source Package Compilation Process
The source code package refers to the program compiled by the programmer, but does not compile the source, the original code to compile the executable procedure as shown in the brief compilation process:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/6C/wKiom1XjkY6xj8IrAAD7vME8ASU158.jpg "title=" Compilation process 1.jpg "alt=" Wkiom1xjky6xj8iraad7vme8asu158.jpg "/>
# Just a brief description of the C language source code compilation process, the actual process is much more complex than shown
Process: Source--------------------
Where: preprocessing through the preprocessor processing, compiled through the GCC compiler processing, assembly through the assembler processing, link through the linker processing
File format processing: name.c file--Multiple NAME.O destination Files----NAME executable file
Simplifying the compilation process
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/68/wKioL1Xjk6zjMF31AAF9C4sYIWs688.jpg "title=" Compilation process 2.jpg "alt=" Wkiol1xjk6zjmf31aaf9c4syiws688.jpg "/>
Ordinary users in the source package installation, the need to install the above development software and complete preprocessing, compilation, compilation, link process to achieve the source package to compile.
For the convenience of ordinary users of the installation of the source code, ordinary users only need to install the necessary development environment, and then can be mainly through the Configure script file and make command to complete, simplifying the source package compilation and installation process.
Where the Configure script file is provided when the programmer writes the source package, the Make command is a tool that developers use more.
A. The primary role of the Configure script is to generate a makefile file based on the compiler attribute used for the specified compilation, by checking the user's compilation environment;
B. Make tool can be compiled according to the generated makefile file in the relevant file name, build binary executable program files, the essence of making tool is to generate the corresponding target file to the source file, and then to multiple target files and call the relevant library functions to produce 1 binary executable program files;
Source Package Compilation Installation process
1. Obtain source package files from reliable sources and verify the integrity of the source packages;
2. The source package to the correct format of the decompression expansion;
3. Install the necessary basic software: development environment and development tools (this is not required, if you must install the first time you compile the installation);
# Development tools: Development tools, Server Plat form development
4. Enter the source code package directory, view the install or Readme file content, mainly describes the installation process and basic considerations;
5. Run under the source package directory./configure--help to view the Configure Help instructions, run the./configure script file to create the makefile file, you can specify the installation location and specify the enabled features;
6. Compile: Execute the Make clean command (not required) before executing the make command;
# make the clean command reads the work on cleaner in the generated makefile file: Clears the target files on the current system that overlap with this installation
# make command read the makefile file to compile the source file to generate the target file, and then generate the executable file, the executable file is only stored in the current directory and not executed
7. Use the Make install command to install the executable program file to the user-specified directory;
8. Some file configurations need to be modified for a subset of the file system cores to be installed to the individual directory:
A. Modifying the PATH environment variable: Creating a configuration file:/etc/profile.d/soft.sh, adding: path= $PATH: Bin directory for SOFT
B. New Lib library file search path: Create config file:/etc/ld.so.conf.d/soft.conf, add: SOFT lib Directory
C. New h header File search path: Create a Directory Symbolic link file: Ln-s/usr/local/soft/include//usr/include/soft
D. New man File search path: Add path in profile/etc/man.config: MANPATH Soft's man directory
Installation recommendations:
A. The software is installed in the/usr/local directory
B. The source package is installed in the/USR/LOCAL/SRC directory
C. software configuration file etc, library function lib, executable file bin, help document unified in a directory/usr/local/soft/{etc,lib,bin,man}
# because the source package is not installed through the RPM Package Manager, the source package installation information is not recorded in the RPM database, installation and uninstallation of the software need to record a large number of installation information, the source package installed in a single directory when installed and uninstalled do not have to log a lot of information
The above is the source package compilation installation process and basic operating procedures.
I have limited level, if there is improper understanding of the place, please give correct, thank you very much!
This article is from the "Pavel" blog, make sure to keep this source http://pavel86.blog.51cto.com/8349178/1690022
Linux Package Management--the principle and basic method of source code compiling