Source code compilation analysis and lightweight web Server compilation demonstration

Source: Internet
Author: User

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z26457-0.jpg "/>

1. source program compilation analysis 1.1 binary format: that is, some features of the binary program compiled by the programmer based on their own understanding are selected for compilation. If this feature is not selected for compilation, cannot be used, and the differences in the environment will also affect the program performance. 1.2 analysis: the Linux kernel is developed in C language, that is to say, it is a lot of troublesome to compile the C environment, such as compiling first and then compiling, and specifying parameters, at this time, we will need a good management tool, make, which is a project management tool for C or C ++ programs. It can make multiple different files of C programs into one project, in addition, a configuration file is used to provide the configuration file makefilemakefile for the compilation process of this project: it defines how to compile the source program automakeautomaker in these source program files in the order in which make allows the source program to generate a makefile file, but only an incomplete program is generated, that is, the semi-finished product is called makefile. in helps us compile the program) autoconf: The function is to generate a script for the project, that is, configgure. The configgure program is the makefile compiled by the configuration program. in can accept scripts or configurations generated by autoconf, makefile. in tells us how to compile the program. configgure is an interface that interacts with the user and allows the user to select the function installation of the program. The user selects the makefile. output in, And then generate makefile; then the make command will compile the source program in combination with the makefile file area to generate a binary file, and then the make install command will install the binary program to install the library file and configuration file, help File Installation to the specified path 2 below we take a lightweight web server program source code as an example for compilation and installation demonstration 2.1 install development tools and Library 1, as shown in

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z22330-1.jpg "/>

The source program for installing development tools and library 2.2 decompressing compilation is shown in Figure 2 using the software package tengine-1.4.2.tar.gz.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z21309-2.jpg "/>

Decompress the source program 2.3 and execute the configure program to specify the installation location 3.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z23362-3.jpg "/>

Specify the installation location 2.4 install dependency 4 as shown in

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z24618-4.jpg "/>

Install pcre-devel (execute the command again after the installation is complete). In the future, we need to handle the dependency during installation to avoid errors. 2.5 use the make command to compile 5.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z25F3-5.jpg "/>

Use the make command for compilation 2.6 Use the make install command for installation 6, as shown in

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z22D3-6.jpg "/>

Use the make install command to install 2.7 enable Program Analysis 7, as shown in

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z24163-7.jpg "/>

Binary program execution analysis 2.8 edit the environment configuration file, that is, the Application Command vim etc/profile) 8, as shown in

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z25523-8.jpg "/>

Figure 8 Add a path to the Environment configuration file 2.9 log on to the system again to allow the system to read the new configuration file, or use the command source/etc/profile to log on again ), here, I will log on again and view 9.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z21J9-9.jpg "/>

Figure 9 successfully added 2.30 verify the web server startup status 10

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z22024-10.jpg "/>

0 lightweight web server process started successfully 2.3.1 use web page access host ip172.16.51.1) for test 11

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021Z24Z0-11.jpg "/>

1. The web page is successfully accessed through a browser.

This article from "Deng junyang's Blog" Blog, please be sure to keep this source http://djy0000.blog.51cto.com/5816828/1156649

Related Article

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.