Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the source code package compiled by Ubuntu

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to understand Ubuntu compiling source code package, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

When learning to compile, you may encounter the problem of Ubuntu compilation. Here we will introduce the solution to the problem of Ubuntu compilation and share it with you here. So Ubuntu belongs to the linux camp. By the way, since the landlord does not have documents, why do you have to learn ubuntu? it is more convenient to learn documents. In Linux system, software is usually provided in the form of source code or pre-Ubuntu compilation package.

The software source code requires your own Ubuntu to compile binary machine code to use, which is time-consuming to install, but you can adjust the Ubuntu compilation options to determine the features or components you need, or optimize for your hardware platform.

Pre-Ubuntu compiled software packages, usually Ubuntu compiled by the publisher of the software, you just need to copy the software into the system. Considering the applicability of pre-Ubuntu compilation packages, pre-Ubuntu compilation packages are usually not optimized for a particular hardware platform. The functions and components it contains are also a common combination.

In Ubuntu systems, software is usually released as a package file in "deb" format, which is a pre-Ubuntu compilation package. In addition to the software compiled by Ubuntu, the deb package usually includes the copy path of the software, the record of dependencies on other software packages, a general configuration file, and the description, version, author, category, occupied space and other information of the software.

The deb package command follows the following convention:

Soft_ver-rev_arch.deb

Soft is the package name, ver is the software version number, rev is the Ubuntu revision number, and arch is the target schema name

For example: azureus_2.4.0.2-0ubuntu2_all.deb you need to use the "dpkg" command to manage the deb package:

Dpkg-I |-- install xxx.deb installs the deb package

Dpkg-r |-- remove xxx.deb delete software package

Dpkg-r-P |-- purge xxx.deb is deleted together with the configuration file

Dpkg-I |-info xxx.deb to view package information

Dpkg-L xxx.deb to view file copy details

Dpkg-l view information about installed software packages on the system

Dpkg-reconfigure xxx reconfiguration package

Sometimes, when you install a package using "dpkg", you will be prompted that the package depends on other packages. At this point, you install other software packages until the dependencies are met. Or install multiple software packages at the same time

Dpkg-I aaa.deb bbb.deb ccc.deb

APT

If a software dependency is too complex and it is not a wise choice to use "dpkg" to install it, you need to use the APT package management system. APT can automatically check for dependencies, obtain the relevant software package in a preset way, and automatically install and configure it. In fact, in most cases, we recommend that you use the APT package to manage the system.

The APT system requires a software information database and at least one software repository with a large number of deb packages, which we call the "source". The "source" can be a network server, install CD or a local software repository. You need to modify the "/ etc/apt/sources.list" file so that the APT system can connect to the Source.

You can get a list of network installation sources on the following page, and select a faster source based on your network environment.

Http://wiki.ubuntu.org.cn/%E5%BF%AB%E9%80%9F%E8%AE%BE%E7%BD%AE%E6%8C%87%E5%8D%97/DapperDrake

APT system mainly includes commands such as "apt-get" and "apt-cache". They are usually compound commands and contain several subcommands.

Apt-get install xxx install xxx

-d download only

-f forced installation

Apt-get remove xxx Uninstall xxx

Apt-get update updates the software information database

Apt-get upgrade to upgrade the system

Apt-cache search search package

Tips: it is recommended that you often use the "apt-get update" command to update your software information database

Source code packet

For most software, we recommend that you use the APT system to install it. In rare cases, such as when a software is not released in the format of a deb package, or if you need to customize the software that suits you, you can install it by compiling the source code through Ubuntu.

First you need to download the source package of the software and unpack it into some source code files. And for ease of management, we recommend that you move the downloaded source package to the "/ usr/local/src/" directory and unpack it here.

Sudo mv xxx.tar.gz / usr/local/src Mobile Source package

Cd / usr/local/src enter the "/ usr/local/src/" directory

Sudo tar-xzvf xxx.tar.gz unpacking source code

Cd xxx_ver/ source code directory after unpacking

There is usually a "configure" script in the source directory to configure the Ubuntu compilation process that is about to begin. You can execute it.

Sudo. / configure [--prefix=/usr/loca/xxx.]

It automatically detects the Ubuntu compilation environment and dependencies of the software, and generates a "Makefile" file.

You can use the command ". / configure-- help" with parameters, or read the "install" file to see the parameters allowed by the script. For example, use the "--prefix=/usr/local/xxx" parameter to set the installation directory of the software to "/ usr/local/xxx/". (if you must install the software in a directory, we recommend that you install it here.)

Now execute the "make" command, and the system will, according to the settings in the "Makefile" file, use the "make" tool to call the Ubuntu compiler and the required resource file, and compile the source code file Ubuntu into the target file.

Sudo make

Execute the "make install" command, and the "make" tool will automatically connect the target file, copy the resulting file to the path set by the "Makefile" file, and complete activities such as changing the file's properties, deleting residual files, and so on.

Sudo make install

Now that your Ubuntu compilation and installation is complete, you need to make a symbolic link to the program's executable file in order to make it easier to use.

Sudo ln-sf / usr/local/xxx/exe / usr/local/bin/exe

Tips: in order to compile Ubuntu smoothly, you need to install at least the "build-essential" package.

Install it using the command "sudo apt-get install build-essential".

This is the answer to the question about how to understand the Ubuntu compiled source package. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report