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 编译内核依赖