0

我正在使用运行 Ubuntu 12.04 的服务器

我想在其中安装 boost 库。我知道

sudo apt-get install libboost-all-dev

将完成工作,但它会安装最新版本 1.52 或更高版本。

但我需要安装特定版本 1.40,因为我用于学术目的的模拟器存在问题。什么是特定命令,以便我可以安装 boost 库以及它的其他要求,如链接文件

提前致谢

4

2 回答 2

0

通常你下载源代码,构建它(有些部分不仅仅是像 Windows 上的文件系统这样的头文件)。然后你可以选择你想要安装的库子集(你可以只用你需要的东西制作紧凑版本)。然后通过调用引导脚本,将它构建到另一个目录,这是你想要的库子集,然后调用 install。

这是一个很好的描述如何做到这一点:http ://ubuntuforums.org/showthread.php?t=1180792

于 2013-10-04T11:52:23.547 回答
0

快速回答: sudo apt-get install libboost-dev= 1.40.0.1

如果它不起作用,请继续阅读。

apt-get确实支持安装特定版本的包as long as it is in an archive that apt knows about。从apt-get手册页:

A specific version of a package can be selected for installation by following the 
package name with an equals and the version of the package to select. This will 
cause that version to be located and selected for install. Alternatively a specific       
distribution can be selected by following the package name with a slash and the version of 
the distribution or the Archive name (stable, frozen, unstable).

例如,如果您想为 Ubuntu安装apache 2.20 ,您可以执行以下操作:

sudo apt-get install apache2=2.2.20-1ubuntu1

请注意,在这种情况下,您可能需要自行解决一些依赖关系,但如果有任何问题,apt-get 会告诉您是什么原因造成的。例如(11.04)

sudo apt-get install apache2=2.2.20-1ubuntu1 \
                     apache2.2-common=2.2.20-1ubuntu1 \
                     apache2.2-bin=2.2.20-1ubuntu1 \
                     apache2-mpm-worker=2.2.20-1ubuntu1 

注意:您必须首先检查构建 1.40 是否仍然可用。对于该用途:

aptitude search libboost

如果 aptitude search 命令没有给您足够的结果,请尝试sudo aptitude update然后aptitude search再次运行。

您可能需要调查是否可以安装早期 Ubuntu 版本的 deb。即删除当前包,下载 debs 并尝试安装它们。但是可能会依赖于旧版本的标准库。如果是这样,您可以尝试从launchpad.

作为最后的手段,从boost.org 下载并构建它 - 痛苦!

编辑:我看到你在 ubuntu 论坛上问过同样的问题,似乎你有 1.48 作为默认值。您可能必须自己构建库。你能试试这个apt-get

sudo apt-get install libboost1.40-all-dev=1.40.0-4ubuntu4

如果这不起作用,您将不得不自己构建并安装它。您可以从以下位置下载源代码

下载源(1.40.0): libboost 1.40.0 源文件

安装后,运行以下命令来保存你安装的版本,防止包管理器在未来自动更新它:

sudo echo "[packagename] hold" | sudo dpkg --set-selections

来源:如何在 Ubuntu 上降级软件包

于 2013-10-04T13:06:57.010 回答