卸载boost并安装另一个版本 [英] Uninstall boost and install another version

查看:1662
本文介绍了卸载boost并安装另一个版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

我找不到 boost网站上的文档,无法通过.tar.gz软件包安装boost.

I couldn't find the documentation on the boost website to install boost from the .tar.gz package.

推荐答案

Boost可以通过两种方式安装

Boost can installed by two ways

  • Deb包
  • 获取并手动安装

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

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

可以从链接下载所需的增强版本.我正在下载1.54版本.然后解压缩并安装它.

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

# 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"

您将看到以下内容

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

已安装增强版1.54

Version 1.54 of boost is installed

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

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

这篇关于卸载boost并安装另一个版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆