Linux source code compilation process __linux

Source: Internet
Author: User
1, Tar: Extract the Source software package. Tar zxvf abc.gz
This step has nothing to say, the source pack to unpack the good, then the next step. 2, CD: Access to this source package.

Now LS a bit MRTG this directory has a blue font httpd-2.2.11 This directory, this directory is we just unpacked, and then the CD into the directory below. If you do not enter into this directory but direct./configure the following illustration appears. 3.   /configure: "Configure" will test the existing features (or bug!) on your system and then create Makefile files to complete make. The "Configure" script has a number of command-line options, and these options may change for different packages, but many of the basic options will not change. And the most we use is the following command:./configure--prefix=/The path to be installed by the software but we can also direct./configure without specifying a path, the software default path that is usually compiled from the source package is/usr/local/, if. /configure is not successful and directly to make, there will be the following image error: When we finish./configure error, and then again./configure successful, we can compile the program. Say a few things about whether you can compile a successful file:/etc/ld.so.conf, Ldconfig first of all,/etc/ld.so.conf, the path of the dynamic-link library that is recorded in this file at compile time, by default the compiler will only use/lib and/usr/ Lib these two directories under the library file, if you installed other libraries, then the installation is completed in/etc/ld.so.conf the library file in the absolute path to write in the OK. Let's see what Ldconfig is: He's a program, and its role is to cache paths in/etc/ld.so.conf to/etc/ Ld.so.cache, so after installing some library files or modifying ld.so.conf to add a new path, you need to run the/sbin/ldconfig so that all the library files are cached Ld.so.cache, if you do not run/sbin/ldconfig, Even if the library file is in the/etc/ld.so.conf, it will not be used, the result is the same error in compiling the XXX library. 4, make: Compile the program. At compile time, there is a difference between GCC versions, so sometimes with different versions of GCC to compile, some version can be compiled successfully, and some failed to compile, such errors are only version problems. Another mistake that comes up in make is that it's tricky, and it's justCan find the reason by experience, for example, a header file is not found, this time to follow the wrong position line to look up, such as display xxxxxx.h.........no such file or directory, the lack of header files, Or find the wrong information that you think is valuable to search engines, you may find useful information from here, the most important thing is to carefully look at the README, INSTALL files before the installation, these two files will tell you how to install the program, what needs to rely on files and so on. Sometimes at compile time does not know whether compiles succeeds, but does not have the compilation success to Make  install certainly will be wrong, thus increased the question complexity, as the saying goes that good "while outsmart", thus we may in make End with a command to check for successful compilation: echo   $? Enter this command return, the output of the result is 0, then the success of compiling, otherwise it is a mistake, echo   $? Indicates that the exit status of the previous command is checked and the program exits normally and returns 0. 5,    make install: installation files. It also reads the instruction from the Makefile and installs it to the specified location. See the above figure output 0 we can make  install to install, after running the input echo   $? Check to see if there are any errors, as long as the output is 0, that means our installation is actually successful./configure, make, make  install these three commands, we can use && to connect the command to execute, indicating that the current After the command is finished, the following commands are executed, which is good, saves time, and prevents errors. Example: ./configure   &&   make   &&   make   install

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.