Linux Code Package compilation

Source: Internet
Author: User

1 , compile and install the source code package :

First, let's take a look at the source code package

1, the source code package is the source code of the visible package, Linux-based and BSD system software is the most common.

2, the source code package can be based on their own needs to compile the most suitable for their own program

3, the source code package compression format file.tar.gz file.tar.bz2 file.tar.xz.

2 to compile the environment on which the source code package depends:

Depending on the development environment of the source code, the tools used to compile the source code are different

For example, according to the C language development of the source Code compilation tool for GCC, and if the source is divided into multiple source code files, then how to compile the same, how to distinguish the order? The role of the project management tool is to organize multiple files to be compiled as a file, using the GNU make tool. Automake automatically provides configuration files for make, but Automake provides makefile.in files, and the required configuration file is makefile, so the Autoconf tool generates configure files based on the compilation environment feature configuration script. The purpose of the Configure file is to combine makefile.in to generate makefile files. It is then called by make.

3 , compile the source code step:

1. Download the source code package

2. Extract the source code package

   a) tar XF Testapp-version.tar. {Xz|bz2|gz}

   b) CD testapp-version cut into the pressurized file directory

   650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;margin-left:0px;border-top-width:0px;margin-right:0px; "Border=" 0 "alt=" image "Src=" Http://img1.51cto.com/attachment/201407/20/7021142_1405841268uoiz.png "width=" 249 "height=" 153 "/>

   c)./configure execute this file, also through many of the specified compilation attributes

1. Get Help

./configure--help

2, some of the more common options

Installation path Related:

--prefix=/path/to/somewhere: Specifying the installation path

--sysconfdir=/path/to/somewhere: Specify the configuration file installation path

Specify enabled/disabled attributes

--enable-feature: for example--ENABLE-FPM

--disable-feature: for example--disable-socket

Specify the features, programs, or files that you depend on

--with-function[=/path/to/somewhere]

--without-function

650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;border-top-width:0px; " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/20/7021142_1405841270ltSe.png" width= "244" Height= "/>"

650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;border-top-width:0px; " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/20/7021142_1405841274xyX9.png" width= "244" Height= "/>"

Missing library file, install yum install Pcre-devel

650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;border-top-width:0px; " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/20/7021142_14058412854QYI.png" width= "244" height= "142"/>

Successful execution!

D) Make

Directly execute the make results as follows, without errors, you can perform the next installation

650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;border-top-width:0px; " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/20/7021142_1405841305XDAF.png" width= "244" Height= "/>"

e) Make Istall installation complete

650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;border-top-width:0px; " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/20/7021142_1405841307ZthE.png" width= "244" Height= "/>"

3, post-installation configuration

As you can see, we execute the NGINX program is executed under the/usr/local/nginx/sbin/program, then in the home directory can be executed? Let's take a look.

Tip Without this command, why is that? is because we are not in the search path of the PATH environment.

650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;border-top-width:0px; " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/20/7021142_1405841311CujL.png" width= "244" Height= "/>"

1, we need to add the environment variable in path if we want to run the installed binaries directly.

Start by creating appname.sh (your file name ends with. Sh) in the/etc/profile.d/directory

Write down export path= $PATH in appname.sh:/path/to/somewhere (your file path)

650) this.width=650; "title=" image "style=" border-right-width:0px;border-bottom-width:0px;border-top-width:0px; " Border= "0" alt= "image" Src= "Http://img1.51cto.com/attachment/201407/20/7021142_1405841323Hk0E.png" width= "244" Height= "/>"

2, Import manual page

We usually use the man command to view the help information of a command, but Nginx does not. That was supposed to be

We have a description in the/etc/man.config file, so we'll add one in.

Man–m/path/to/somewhere KEYWORD

Program development: If other applications rely on the development of this program, or do two development for this program will need to

1. Export the library file

The system will save the library files and the path that can be found on the current system through/etc/ld.so.cache, so it is necessary to let the system search for the customized paths.

Editor:/etc/ld.so.conf.d/appname.conf

One row a library file path, write it in.

2. Trigger system to re-search all library files and generate cache

Ldconfig–v

3, Export header file

Custom installations are typically/etc/local/nginx/include in their own installation directory

System your change file The road is:/usr/include

So, create a connection to

Ln–sv/usr/local/nginx/include/usr/include/nginx

END

This article is from the "Aolens blocks until those" blog, be sure to keep this source http://aolens.blog.51cto.com/7021142/1440516

Linux Code Package compilation

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.