卸载boost并安装另一个版本
Uninstall boost and install another version
我已经在Linux Mint 12上使用命令sudo apt-get install libboost-dev libboost-doc
安装了boost库,该命令安装了存储库中可用的默认版本。然而,我要做的项目需要1.44版本的boost。如何卸载默认(当前)版本1.46并安装1.44?
我在boost网站上找不到从.tar.gz
包安装boost的文档。
Boost有两种安装方式
- Deb包
- wget并手动安装
在某些情况下,我们可能同时安装了这两种类型,这会导致版本错误。让我们看看如何卸载这两个。
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_*
如果不满足,我们需要安装其他依赖项
sudo apt-get -y install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev
让我们从链接下载我们需要的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
现在检查已安装的版本
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版本的boost
就是这样,它对我有效。
可以使用
卸载apt-get --purge remove libboost-dev libboost-doc
从boost网站下载所需的包,解压并按照解压目录index.html中的"getting started"说明操作
在Ubuntu 20.04中使用我的脚本卸载旧版本的boost,并按照上面的ram指示操作
#!/bin/bash
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
echo "clear boost dir"
sudo rm -r /usr/local/lib/libboost*
sudo rm -r /usr/local/include/boost
sudo rm -r /usr/local/lib/cmake/[Bb]oost*
sudo rm -f /usr/lib/libboost_*
sudo rm -r /usr/include/boost
降级boost版本。我不熟悉Mint,但假设它是基于债务的,你可以这样做:
apt-cache show libboost-dev
查看所有可安装版本,并使用
安装特定版本sudo apt-get install libboost-dev=1.42.0.1
对于主要的boost版本也有方便的包:
sudo apt-get install libboost1.44-dev
就像@savamane写的,你可以用
卸载它 apt-get --purge remove libboost-dev libboost-doc
另一个安装.deb
包的建议。(请下载适合您的架构的版本)。
对于仍然支持的发行版,您可以简单地在http://packages.ubuntu.com/的发行版上搜索该包。例如,libboost-system1.46.1
可以在precise
-> Libraries
标签下找到。
对于不支持的发行版,仍然有机会在http://archive.ubuntu.com/。例如libboost-all-dev_1.40.0.1_amd64.deb
可以在http://archive.ubuntu.com/ubuntu/pool/universe/b/boost-defaults/。
安装特定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
- 删除一个线程上有数百万个字符串的大型哈希映射会影响另一个线程的性能
- 运行同一解决方案的另一个项目的项目
- 为什么在没有显式默认构造函数的情况下,将另一个结构封装在联合中作为成员的结构不能编译
- 基于另一个成员参数将函数调用从类传递给它的一个成员
- C++从另一个类访问公共静态向量的正确方法是什么
- C++-试图将函数指针推回到另一个CPP文件中的矢量时出错
- 使用std::transform将一个范围的元素添加到另一个范围中
- 输入到文件并输出到另一个文件,并将流文件传递给函数
- 我可以将一个用clang c++11编译的对象与另一个用c++17编译的对象链接起来吗
- 修改函数中的指针(将另一个指针作为参数传递)
- 为什么我不能将一个对象push_back到属于另一个类的对象向量中?
- C++试图读取一个文件并输出到另一个文本文件
- 如何将指针从一个void函数传递到另一个C++
- 用Cmake构建在一个QTCreator版本中与另一个QTCreator版本一起使用,并与terminal的Catkin
- 如何在C 中输出两个字符串版本,一个具有逃生字符,另一个则不是
- 查找最大和连续子数组-另一个版本
- 如何解决另一个版本的Kakuro
- 卸载boost并安装另一个版本
- Qt Creator使用位于另一个地方的另一个GCC版本
- Qt版本5.3发送数据从一个论坛到另一个