boost在不同平台下的编译(win、arm)

首先下载boost源码

下载完成之后解压

前提需要自行安装gcc等工具

window

bash 复制代码
./bootstrap.sh
./b2
./b2 install

arm (linux)

powershell 复制代码
sudo ./bootstrap.sh
sudo ./b2 cxxflags=-fPIC cflags=-fPIC link=static -a threading=multi
sudo ./b2 install

x86 (linux)

powershell 复制代码
sudo ./bootstrap.sh

在boost_1_77_0/tools/build/src/tools目录下找到gcc.jam文件,打开它。在

powershell 复制代码
compile-link-flags <link>shared/<target-os>$(non-windows) : -fPIC ;

下新增一行:

powershell 复制代码
compile-link-flags <link>static/<target-os>$(non-windows) : -fPIC ;

(提示:复制前一行,修改shared为static即可)。

powershell 复制代码
sudo ./b2 cxxflags=-fPIC cflags=-fPIC link=static -a threading=multi
sudo ./b2 install

完成

boost头文件路径(以1.77为例)

powershell 复制代码
boost_1_77_0/boost

boost库文件路径(以1.77为例)

powershell 复制代码
boost_1_77_0/stage/lib
相关推荐
江安下小雨17 分钟前
muduo网络库(十三):Buffer 缓冲区类
c++·经验分享
liulilittle1 小时前
XTCP简述
网络·c++·tcp/ip·ip·tcp·通信
一只旭宝2 小时前
预约系统版本2(基于第一版改良)
服务器·数据库·c++
被怪兽吃掉了2 小时前
5.2.1一维组数定义方式
开发语言·c++·算法
旖旎夜光2 小时前
LeetCode 69:x 的平方根(二分查找) —— 题解
数据结构·c++·算法·leetcode·二分查找
j7~2 小时前
【C++】《C++二叉搜索树(BST)从入门到精通:概念、实现与Key/Value模型全解析》
开发语言·c++·学习·二叉搜索树
hehelm2 小时前
仿muduo库实现高并发服务器—Channel类
linux·服务器·开发语言·网络·c++
余额瞒着我当琳2 小时前
C++ list第二讲数据结构修炼:迭代器源码 + 栈队列适配器 + LeetCode 三道高频题
数据结构·c++·list
hehelm2 小时前
仿muduo库实现高并发服务器—EventLoop
linux·服务器·网络·c++
_Narcissus_2 小时前
常见数论算法笔记
数据结构·c++·算法·高精度·数论·快速幂·质数筛