Ubuntu learning-compile the source code package

Source: Internet
Author: User
Tags creative commons attribution

Taking the tree utility (using the tree structure to retrieve the directory tree) as an example, this article describes how to manage the source code package in Ubuntu, including querying, obtaining, compiling the source code package, and installing it.

1) before obtaining the source code package, make sure that the Deb-Src item is added to the software source configuration file/etc/APT/sources. List.

2) use the following command to obtain detailed information about the tree source package:

Sudo apt-Cache showsrc tree

This is used to query whether the source code package exists in the current image site.

The 3rd source code package usually contains 3 files, with the suffix of dsc,orig.tar.gzand diff.gz respectively. Use the "apt-Get source" command to obtain the source code package. It downloads the source code package to your current directory and calls the dpkg-source command during command execution, based on the information in the DSC file, extract the source code package to the directory of the same name, where the source code of the application is located.

Sudo apt-Get source tree

You must ensure that dpkg-Dev is installed before downloading the source code package (Run "apt-Get install dpkg-dev"). Otherwise, only three files of the source code package will be downloaded, but the source code package will not be decompressed. Of course, you can use the dpkg-source command to decompress the source code package.

4) install dependency-related software packages before compiling the source code package. Use the "apt-Get build-dep" command to obtain and install all related software packages.

Sudo apt-Get build-dep tree

5) Now you can compile the source code package. First, go to the directory where the source code is located and use the dpkg-buildpackage command to compile the source code package. It will place the generated Deb package in the upper directory.

CD tree-1.5.1.2
Sudo dpkg-buildpackage

This will compile the tree-1.5.1.2-1_i386.deb

6) install the software package. Run the "dpkg-I" command to install the generated Deb software package.

Sudo dpkg-I tree-1.5.1.2-1_i386.deb

7) Test the tree program. We use it to view the content of the working directory where the compilation is located.

Tree-L 2

Author: Dongting sangren

Source: http://phinecos.cnblogs.com/

This blog followsCreative Commons Attribution 3.0 LicenseIf it is used for non-commercial purposes, you can reprint it freely, but please keep the original author information and the article URL.

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.