ubuntu 编译内核依赖_如何在Ubuntu上编译软件时解决依赖性

在Ubuntu上编译软件时,最难的是处理依赖性问题。本文介绍了三种方法:使用自动适配(auto-apt)在运行`./configure`时自动安装依赖;使用Apt-File查找缺失文件所属的软件包;以及使用Apt-Get Build-Dep安装已知依赖。这些技巧可以帮助你更轻松地解决编译过程中的依赖问题。
摘要由CSDN通过智能技术生成
ubuntu 编译内核依赖

ubuntu 编译内核依赖

The hardest part of compiling software on Linux is locating its dependencies and installing them. Ubuntu has apt commands that automatically detect, locate and install dependencies, doing the hard work for you.

在Linux上编译软件最困难的部分是找到其依赖项并进行安装。 Ubuntu具有apt命令,该命令可自动检测,定位和安装依赖项,为您完成艰苦的工作。

We recently covered the basics of compiling software from source on Ubuntu, so check out our original article if you’re just getting started.

最近,我们从Ubuntu上的源代码中涵盖了编译软件的基础知识,因此,如果您刚刚起步,请查看我们的原始文章。

自动适应 (Auto-Apt)

Auto-apt watches and waits when you run the ./configure command through it. When ./configure tries to access a file that doesn’t exist, auto-apt puts the ./configure process on hold, installs the appropriate package and lets the ./configure process continue.

自动apt监视并等待通过它运行./configure命令。 当./configure尝试访问不存在的文件时,自动apt会将./configure进程置于保留状态,安装适当的软件包,并让./configure进程继续进行。

First, install auto-apt with the following command:

首先,使用以下命令安装自动apt:

sudo apt-get install auto-apt

sudo apt-get安装自动apt

Once it’s installed, run the following command to download the file lists it auto-apt requires. This process will take a few minutes.

安装完成后,运行以下命令下载自动适配所需的文件列表。 此过程将需要几分钟。

sudo auto-apt update

sudo自动更新

After the first command is done, run the following commands to update its databases. These commands will also take a few minutes.

完成第一个命令后,运行以下命令以更新其数据库。 这些命令也将花费几分钟。

sudo auto-apt updatedb && sudo auto-apt update-local

sudo auto-apt更新-b && sudo auto-apt update-local

After your’e done building auto-apt’s databases, you can start the ./configure process with the following command:

完成自动apt数据库的构建后,您可以使用以下命令启动./configure过程:

sudo auto-apt run ./configure

sudo auto-apt运行./configure

附件文件 (Apt-File)

If you see an error message that says a specific file is missing, you may not know the package you have to install to get the file. Apt-file lets you find the packages that contain a specific file with a single command.

如果您看到一条错误消息,提示缺少特定文件,则可能不知道要获取该文件必须安装的软件包。 使用Apt-file,您可以使用单个命令查找包含特定文件的软件包。

First, you’ll have to install apt-file itself:

首先,您必须自己安装apt-file:

sudo apt-get install apt-file

sudo apt-get安装apt-file

After it’s installed, run the following command to download the file lists from your configured apt repositories. These are large lists, so downloading them will take a few minutes.

安装完成后,运行以下命令从配置的apt资料库下载文件列表。 这些都是大列表,因此下载它们将花费几分钟。

sudo apt-file update

sudo apt文件更新

Run the following command, replacing “example.pc” with a file name, and the command will tell you exactly which package you need to install:

运行以下命令,用文件名替换“ example.pc ”,该命令将准确告诉您需要安装哪个软件包:

apt-file search file example.pc

apt文件搜索文件example.pc

Install the package with the standard apt-get install command:

使用标准的apt-get install命令安装软件包:

sudo apt-get install package

sudo apt-get安装软件包

You can also perform a file search from the Ubuntu Package Search website. Use the “Search the contents of packages” section on the page to search a specific file.

您也可以从Ubuntu软件包搜索网站上执行文件搜索。 使用页面上的“ 搜索软件包的内容 ”部分搜索特定文件。

It’ll give you the same results as apt-file, and you won’t have to download any file lists.

它会为您提供与apt-file相同的结果,并且您无需下载任何文件列表。

Apt-Get Build-Dep (Apt-Get Build-Dep)

We covered apt-get build-dep in our initial post. If an earlier version of the program you’re trying to install is already in Ubuntu’s package repositories, Ubuntu already knows the dependencies it requires.

我们在最初的文章中介绍了apt-get build-dep。 如果您要安装的程序的早期版本已经在Ubuntu的软件包存储库中,则Ubuntu已经知道它所需的依赖项。

Type the following command, replacing “package” with the name of the packge, and apt-get will install the required dependencies:

输入以下命令,将“ package ”替换为packge的名称,apt-get将安装所需的依赖项:

sudo apt-get build-dep package

sudo apt-get build-dep软件包

Apt-get prompts you to install all the required dependencies.

Apt-get提示您安装所有必需的依赖项。

If a newer version of the program requires different dependencies, you may have to install some additional dependencies manually.

如果程序的较新版本需要不同的依赖关系,则可能必须手动安装一些其他的依赖关系。



All these commands use apt-get, so you can also them on Debian, Linux Mint and any other Linux distribution that uses apt-get and .deb packages.

所有这些命令都使用apt-get,因此您也可以在Debian,Linux Mint和使用apt-get和.deb软件包的任何其他Linux发行版中使用它们。

翻译自: https://www.howtogeek.com/106526/how-to-resolve-dependencies-while-compiling-software-on-ubuntu/

ubuntu 编译内核依赖

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值