Linux 卸载 boost 并安装另一个版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8430332/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 03:33:24  来源:igfitidea点击:

Uninstall boost and install another version

c++linuxboostinstall

提问by freinn

I've installed the boost libraries on Linux Mint 12 using the command sudo apt-get install libboost-dev libboost-doc, which installs the default version available in the repositories. However, the project I have to do needs the 1.44 version of boost. How do I uninstall the default (current) version 1.46 and install 1.44?

我已经使用命令在 Linux Mint 12 上安装了 boost 库,该命令sudo apt-get install libboost-dev libboost-doc安装了存储库中可用的默认版本。不过我要做的项目需要1.44版本的boost。如何卸载默认(当前)版本 1.46 并安装 1.44?

I couldn't find the documentation on the boost websiteto install boost from the .tar.gzpackage.

我在boost 网站上找不到用于从.tar.gz包安装 boost的文档。

回答by savamane

You can uninstall with

你可以卸载

apt-get --purge remove libboost-dev libboost-doc

Download the package you need from boost website, extract and follow "getting started" instructions found inside index.html in the extracted directory.

从 boost 网站下载您需要的软件包,提取并按照提取目录中 index.html 中的“入门”说明进行操作。

回答by thiton

Downgrade your boost version. I'm not familiar with Mint, but assuming it is deb-based, you can do:

降级您的增强版本。我不熟悉 Mint,但假设它是基于 deb 的,你可以这样做:

apt-cache show libboost-dev

to see all installable version and install a specific version with

查看所有可安装版本并安装特定版本

sudo apt-get install libboost-dev=1.42.0.1

There are also convenience packages for the major boost versions:

主要增强版本也有便利包:

sudo apt-get install libboost1.44-dev

回答by L?iten

As @savamane wrote you can uninstall it with

正如@savamane 所写,您可以使用以下命令卸载它

apt-get --purge remove libboost-dev libboost-doc

apt-get --purge remove libboost-dev libboost-doc

Another suggestion to install the .debpackages as suggested here. (Download the one fitted for your architecture though).

.deb按照此处的建议安装软件包的另一个建议。(尽管下载适合您的架构的那个)。

For still supported distros, you can simply search for the package at the distributions at http://packages.ubuntu.com/. For example libboost-system1.46.1can be found in under the precise-> Librariestab.

对于仍受支持的发行版,您只需在http://packages.ubuntu.com/ 的发行版中搜索该软件包即可。例如libboost-system1.46.1可以在precise->Libraries选项卡下找到。

For unsupported distros, there is still a chance to find them at http://archive.ubuntu.com/. For example can libboost-all-dev_1.40.0.1_amd64.debbe found in http://archive.ubuntu.com/ubuntu/pool/universe/b/boost-defaults/.

对于不受支持的发行版,仍有机会在http://archive.ubuntu.com/上找到它们 。例如可以libboost-all-dev_1.40.0.1_amd64.debhttp://archive.ubuntu.com/ubuntu/pool/universe/b/boost-defaults/ 中找到 。

回答by Carlos Gamarra charlie

This is how you install a specific Boost version:

这是安装特定 Boost 版本的方法:

cd boost_1_54_0/

./bootstrap.sh --with-libraries=atomic,date_time,exception,filesystem,iostreams,locale,program_options,regex,signals,system,test,thread,timer,log

sudo ./b2 install

回答by ram

Boost can installed by two ways

Boost 可以通过两种方式安装

  • Deb package
  • wget and install manually
  • 德包
  • wget 并手动安装

In some case we might have installed by both type which can cause version error. Lets see how to uninstall both.

在某些情况下,我们可能同时安装了这两种类型,这可能会导致版本错误。让我们看看如何卸载两者。

sudo apt-get update

# to uninstall deb version
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
# to uninstall the version which we installed from source
sudo rm -f /usr/lib/libboost_*

Then we need to install other dependencies if they are not met

然后我们需要安装其他依赖如果不满足

sudo apt-get -y install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev

Lets download the boost version which we need from the link. I am downloading the 1.54 version. Then untar and install it.

让我们从链接下载我们需要的 boost 版本。我正在下载 1.54 版本。然后解压并安装它。

# go to home folder
cd
wget http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
tar -zxvf boost_1_54_0.tar.gz
cd boost_1_54_0
# get the no of cpucores to make faster
cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
echo "Available CPU cores: "$cpuCores
./bootstrap.sh  # this will generate ./b2
sudo ./b2 --with=all -j $cpuCores install

Now let's check the installed version

现在让我们检查安装的版本

cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION"

You will something like below

你会像下面这样

//  BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
#define BOOST_LIB_VERSION "1_54"

Version 1.54 of boost is installed

安装了 boost 1.54 版本

That's it, it worked for me. Let me know if you face any issues.

就是这样,它对我有用。如果您遇到任何问题,请告诉我。