Package Management-source code compilation and installation

Source: Internet
Author: User

Basic understanding

In a larger project, all files cannot be edited in a single file. The source code is often stored in multiple files, easy to maintain and manage in the future, so it is not easy to compile and install.

After the project is completed, the publisher of the project will typically do the following:

1. autoconf: The Configure fileis generated .

This file is primarily used to check whether the compilation environment meets the compilation requirements and define which features or features are enabled, and define the installation path.

The result is that the makefile file is generated in conjunction with makefile.in .

2,automake: Generate makefile.in file.

Steps for compiling the installation ( example of installing Python in source code)

1, unzip the source package.

Command:tar XF pkg-name

# Tar XF python-2.7.11.tgz

2, switch into the unpacking package.

3.View Configure Help information

#./configure--help

4.Execute The configure script and specify the installation path.

#./configure--prefix=/usr/local/python--sysconfdir=/etc/python.conf

Generated the makefile file

5, compile and install.

# make && make install.

Supplement:Configure script common function, (can be configured by itself)

1. Specify the installation path

--prefix=/usr/local/python

--sysconfdie=/etc/python

2. Specify the start or disable feature

--enable-feature

--disable-feature

3.Specify the functions, programs, or files on which you depend

--with-funciton

--without-function

Post-compilation work

1. Import the binary program into the system visible range:

# vim/etc/profile.d/xxx.sh

Path=/usr/local/xxx:$PATH

Export PATH

# {. | source}/etc/profile.d/xxx.sh

[Email protected] python-2.7.11]# Vim/etc/profile.d/python.sh[[email protected] python-2.7.11]#. /etc/profile.d/python.sh[[email protected] python-2.7.11]# cat/etc/profile.d/python.sh Path=/usr/local/python/bin :/usr/local/python/sbin: $PATHexport PATH

2, the header file import system is visible:

# ln-sv/usr/local/python/include//usr/include/python

[Email protected] python-2.7.11]# ln-sv/usr/local/python/include//usr/include/'/usr/include/include '/usr/ local/python/include/'

3. Import the library file

# vim/etc/ld.so.conf.d/python.conf

/usr/local/python/lib

# ldconf Let the system generate a cache of library files.

[Email protected] python-2.7.11]# vim/etc/ld.so.conf.d/python.conf[[email protected] python-2.7.11]# ldconfig[[ Email protected] python-2.7.11]# Cat/etc/ld.so.conf.d/python.conf/usr/local/python/lib

4. import the man file

# vim/etc/man.conf

Manpath/usr/local/xxx/man

Note:python does not have A man document and is not modified here.


This article is from the "11219885" blog, please be sure to keep this source http://11229885.blog.51cto.com/11219885/1750696

Package Management-source code compilation and installation

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.