install boost on ubuntu

10 篇文章 1 订阅

You can use apt-get command (requires sudo)

sudo apt-get install libboost-all-dev

Or you can call

aptitude search boost

find packages you need and install them using the apt-get command.


updated on 16/10/2017

1. check boost version

dpkg -S /usr/include/boost/version.hpp

Get the version of Boost that you require. This is for 1.55 but feel free to change or manually download yourself:

wget -O boost_1_55_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
tar xzvf boost_1_55_0.tar.gz
cd boost_1_55_0/

Get the required libraries, main ones are icu for boost::regex support:

sudo apt-get update
sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev

Boost's bootstrap setup:

./bootstrap.sh --prefix=/usr/

Then build it with:

./b2

and eventually install it:

sudo ./b2 install 

要在Ubuntu上使用QNX工具链对Boost 1.74.0进行离线交叉编译,首先你需要确保在你的Ubuntu机器上已经安装了必要的QNX开发工具和依赖。以下是大致的步骤: 1. **安装QNX SDK**:首先,你需要从QNX官网下载并安装适合的QNX SDK。安装完成后,通常会在`<qnx-sdk-path>/usr/bin`找到交叉编译工具链,例如`arm-vfpv3le-gcc`。 2. **下载Boost离线包**:由于你想要离线编译,你需要提前下载Boost 1.74.0的源码包。你可以从Boost官方仓库下载zip格式的源码包。 3. **创建构建环境**:在Ubuntu上,可以使用`cmake`来建立一个自定义的构建目录,指定QNX的工具链作为构建工具: ```bash mkdir boost_1_74_0_qnx cd boost_1_74_0_qnx wget https://dl.bintray.com/boostorg/release/1.74.0/source/boost_1_74_0.tar.gz tar xzf boost_1_74_0.tar.gz cd boost_1_74_0 cmake -DCMAKE_TOOLCHAIN_FILE=<path_to_your_cmake_qnx_file> -DBoost_NO_BOOST_CMAKE=ON .. ``` `<path_to_your_cmake_qnx_file>`是你自定义的CMakeLists.txt文件,其中指定了QNX工具链和路径信息。 4. **编译Boost**: ```bash make ``` 这将会启动交叉编译过程。由于是离线编译,CMake可能需要一些手动干预,例如添加合适的库路径。 5. **安装Boost库**: ```bash make install ``` 安装完成后,你需要将Boost库复制到一个能被Ubuntu访问的地方,比如通过网络共享目录。 6. **验证编译**: 在Ubuntu上,你可以在终端中尝试编译一个小项目来确认Boost是否可用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值