当前位置: 首页 > news >正文

CentOS 7 编译安装Boost

1、前提条件

linux平台/CentOS 7 下要编译安装Boost除gcc和gcc-c++之外,还需要两个开发库:bzip2-devel 和python-devel ,因此在安装前应该先保证这两个库已经安装。

安装指令:

yum install bzip2 bzip2-devel bzip2-libs python-devel

CentOS 7安装效果:

[root@localhost ~]# yum install bzip2 bzip2-devel bzip2-libs python-devel
已加载插件:fastestmirror
Determining fastest mirrors* base: mirrors.ustc.edu.cn* extras: mirrors.ustc.edu.cn* updates: mirrors.163.com
base                                                                                                                     | 3.6 kB  00:00:00
docker-ce-stable                                                                                                         | 3.5 kB  00:00:00
extras                                                                                                                   | 2.9 kB  00:00:00
updates                                                                                                                  | 2.9 kB  00:00:00
(1/2): docker-ce-stable/7/x86_64/primary_db                                                                              | 117 kB  00:00:26
(2/2): updates/7/x86_64/primary_db                                                                                       |  23 MB  00:02:58
软件包 bzip2-libs-1.0.6-13.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
*********

2、安装

Boost 官网下载地址:https://www.boost.org/

将下载的boost 源码:boost_1_83_0_rc1.tar.gz, 上传CentOS 7 指定目录,我的目录地址为:/usr/local/source_code/.

CentOS  7 指令效果:

[root@localhost ~]# cd /usr/local/source_code/
[root@localhost source_code]# ll
总用量 146560
-rw-r--r--. 1 root root  144648962 10月 13 10:33 boost_1_83_0_rc1.tar.gz
drwxr-xr-x. 2 root root         42 9月  18 17:32 c_demo
drwxrwxr-x. 6 root root       4096 10月 10 09:44 hiredis-1.2.0
-rw-r--r--. 1 root root     126216 10月 10 09:42 hiredis-1.2.0.tar.gz
drwxr-xr-x. 2 root root         50 10月 10 10:37 hiredis_demo
drwxr-xr-x. 5  500 users      8192 9月   4 15:28 jpeg-9e
-rw-r--r--. 1 root root    1046935 9月   4 15:23 jpegsrc.v9e.tar.gz
-rw-r--r--. 1 root root    4234219 8月  31 16:22 release-3.4.13.tar.gz
drwxr-xr-x. 2 root root         52 10月 10 12:54 zookeeper_demo
drwxrwxr-x. 8 root root        259 8月  31 16:33 zookeeper-release-3.4.13

解压Boost 源码 并安装,执行如下命令:

# 解压boost 源码
tar -zxvf boost_1_83_0_rc1.tar.gz
# 进入boost 源码目录
cd boost_1_83_0
# 启动 boost 安装指南脚本./bootstrap.sh
# 安装boost 全部 模块
./b2 install --with=all

 CentOS  7 指令效果:

# 进入Boost 源码目录
[root@localhost source_code]# cd boost_1_83_0
# 启动Boost 库安装指南sh
[root@localhost boost_1_83_0]# ./bootstrap.sh
Building B2 engine..###
###
### Using 'gcc' toolset.
###
###g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright © 2015 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。###
###> g++ -x c++ -std=c++11 -O2 -s -DNDEBUG builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filesys.cpp filent.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp modules/order.cpp modules/path.cpp modules/property-set.cpp modules/regex.cpp modules/sequence.cpp modules/set.cpp -o b2tools/build/src/engine/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... /usr
Generating B2 configuration in project-config.jam for gcc...Bootstrapping is done. To build, run:./b2To generate header files, run:./b2 headers
******
# 安装Boost 模块
[root@localhost boost_1_83_0]# ./b2 install --with=all
Performing configuration checks- default address-model    : 64-bit [1]- default architecture     : x86 [1]- compiler supports SSE2   : yes [2]- compiler supports SSE4.1 : yes [2]- has std::atomic_ref      : no [2]- has -Wl,--no-undefined   : yes [2]- has statx                : no [2]- has statx syscall        : no [2]- has init_priority attribute : yes [2]- has stat::st_blksize     : yes [2]- has stat::st_mtim        : yes [2]- has stat::st_mtimensec   : no [2]- has stat::st_mtimespec   : no [2]- has stat::st_birthtim    : no [2]- has stat::st_birthtimensec : no [2]- has stat::st_birthtimespec : no [2]- has fdopendir(O_NOFOLLOW) : yes [2]- has dirent::d_type       : yes [2]- has POSIX *at APIs       : yes [2]- cxx11_auto_declarations  : no [2]- cxx11_auto_declarations  : no [3]- has_icu builds           : yes [2]
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam.
note: to suppress this message, pass "--without-graph_parallel" to bjam.- zlib                     : yes- bzip2                    : yes- lzma                     : no- zstd                     : no- has_lzma_cputhreads builds : no [2]- cxx11_constexpr          : no [2]- cxx11_constexpr          : no [3]- iconv (libc)             : yes [2]- icu                      : yes [2]- iconv (libc)             : yes [3]
******

3、Boost 快速上手Demo

在指定目录(/usr/local/source_code) ,创建boost 测试目录(boost_demo)。指令如下:

[root@localhost source_code]# mkdir boost_demo
[root@localhost source_code]# cd boost_demo/
[root@localhost boost_demo]# ll
总用量 0

在boost_demo 目录下,创建boost 测试程序:accumulators_demo.cpp。指令如下:

[root@localhost boost_demo]# vi accumulators_demo.cpp

编辑 accumulators_demo.cpp 文件内容如下:

#include <iostream>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/moment.hpp>
using namespace boost::accumulators;int main()
{// Define an accumulator set for calculating the mean and the// 2nd moment ...accumulator_set<double, stats<tag::mean, tag::moment<2> > > acc;// push in some data ...acc(1.2);acc(2.3);acc(3.4);acc(4.5);// Display the results ...std::cout << "Mean:   " << mean(acc) << std::endl;std::cout << "Moment: " << moment<2>(acc) << std::endl;return 0;
}

 编译accumulators_demo.cpp 文件并执行。

[root@localhost boost_demo]# g++ accumulators_demo.cpp -o accumulators_demo
In file included from /usr/local/include/boost/function/detail/prologue.hpp:12:0,from /usr/local/include/boost/function.hpp:30,from /usr/local/include/boost/parameter/aux_/tagged_argument.hpp:88,from /usr/local/include/boost/parameter/aux_/tag.hpp:11,from /usr/local/include/boost/parameter/keyword.hpp:10,from /usr/local/include/boost/parameter/nested_keyword.hpp:10,from /usr/local/include/boost/accumulators/accumulators_fwd.hpp:229,from /usr/local/include/boost/accumulators/framework/accumulator_set.hpp:29,from /usr/local/include/boost/accumulators/accumulators.hpp:12,from accumulators_demo.cpp:2:
/usr/local/include/boost/function/detail/requires_cxx11.hpp:18:192: 附注:#pragma message:C++03 support was deprecated in Boost.Function 1.82 and will be removed in Boost.Function 1.84. Please open an issue in https://github.com/boostorg/function if you want it retained.BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.Function 1.82 and will be removed in Boost.Function 1.84. Please open an issue in https://github.com/boostorg/function if you want it retained.")^
In file included from /usr/local/include/boost/bind/mem_fn.hpp:24:0,from /usr/local/include/boost/mem_fn.hpp:22,from /usr/local/include/boost/function/detail/prologue.hpp:19,from /usr/local/include/boost/function.hpp:30,from /usr/local/include/boost/parameter/aux_/tagged_argument.hpp:88,from /usr/local/include/boost/parameter/aux_/tag.hpp:11,from /usr/local/include/boost/parameter/keyword.hpp:10,from /usr/local/include/boost/parameter/nested_keyword.hpp:10,from /usr/local/include/boost/accumulators/accumulators_fwd.hpp:229,from /usr/local/include/boost/accumulators/framework/accumulator_set.hpp:29,from /usr/local/include/boost/accumulators/accumulators.hpp:12,from accumulators_demo.cpp:2:
/usr/local/include/boost/bind/detail/requires_cxx11.hpp:18:180: 附注:#pragma message:C++03 support was deprecated in Boost.Bind 1.82 and will be removed in Boost.Bind 1.84. Please open an issue in https://github.com/boostorg/bind if you want it retained.BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.Bind 1.82 and will be removed in Boost.Bind 1.84. Please open an issue in https://github.com/boostorg/bind if you want it retained.")^
In file included from /usr/local/include/boost/typeof/typeof.hpp:16:0,from /usr/local/include/boost/accumulators/numeric/functional.hpp:22,from /usr/local/include/boost/accumulators/statistics/mean.hpp:14,from accumulators_demo.cpp:4:
/usr/local/include/boost/typeof/detail/requires_cxx11.hpp:14:102: 附注:#pragma message:C++03 support was deprecated in Boost.Typeof 1.82 and will be removed in Boost.Typeof 1.84.BOOST_PRAGMA_MESSAGE("C++03 support was deprecated in Boost.Typeof 1.82 and will be removed in Boost.Typeof 1.84.")^
[root@localhost boost_demo]# ll
总用量 244
-rwxr-xr-x. 1 root root 245128 10月 13 10:57 accumulators_demo
-rw-r--r--. 1 root root    678 10月 13 10:53 accumulators_demo.cpp
[root@localhost boost_demo]# ./accumulators_demo
Mean:   2.85
Moment: 9.635

4、Boost  常用库

Boost 是一组扩展了 C++ 功能的库。常用的包括:

1. Boost.Asio:包含了一套网络和底层 I/O 编程的接口,支持同步、异步操作。

2. Boost.Unordered:提供了类似 C++11 中的 std::unordered_map, std::unordered_set 等的无序容器。

3. Boost.Thread:封装了线程相关的接口,如线程类、互斥量、条件变量等。

4. Boost.Python:扩展了 Python/C++ 的转换机制,以便于在 Python 和 C++之间进行进行更灵活的程序集成。

5. Boost.Smart_Ptr:包含智能指针,如 shared_ptr,weak_ptr,scoped_ptr 等用于资源管理的类。

6. Boost.Filesystem:提供一套跨平台的文件系统访问方法。

7. Boost.Graph:提供一套图数据结构及相关算法。

8. Boost.Regex:封装了正则表达式的类。

9. Boost.Log:提供一套跨平台的日志库。

10. Boost.Date_Time:时间和日期库,提供一种简单、易于操作的方式来处理时间和日期。

相关文章:

CentOS 7 编译安装Boost

1、前提条件 linux平台/CentOS 7 下要编译安装Boost除gcc和gcc-c之外&#xff0c;还需要两个开发库&#xff1a;bzip2-devel 和python-devel &#xff0c;因此在安装前应该先保证这两个库已经安装。 安装指令: yum install bzip2 bzip2-devel bzip2-libs python-devel Cent…...

vue图表制作

Vue.js是一个非常流行的JavaScript框架&#xff0c;可以用于开发交互式Web应用程序。Vue.js的优点之一是它的灵活性和可扩展性。因此&#xff0c;可以使用Vue.js与许多其他库和框架集成&#xff0c;包括图表库。 下面是使用Vue.js制作图表的一些步骤&#xff1a; 1.选择一个适…...

使用 GitHub Action 自动更新 Sealos 集群的应用镜像

在 IT 领域&#xff0c;自动化无疑已成为提高工作效率和减少人为错误的关键。Sealos 作为一个强大的云操作系统&#xff0c;已经为许多企业和开发者提供了稳定可靠的服务。与此同时&#xff0c;随着技术不断发展&#xff0c;集成更多的功能和服务变得尤为重要。考虑到这一点&am…...

windows频繁更新问题解决方案

解决方案&#xff1a;将更新策略增加到无穷大 1.windowsr 输入regedit 2.找到&#xff1a;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings 3.右键新建DWORD32 4.命名&#xff1a;FlightSettingsMaxPauseDays 5.双击&#xff1a;数值数据改为4321 基数&#…...

day05-前后端项目上传到gitee、后端多方式登录接口、发送短信功能、发送短信封装、短信验证码接口、短信登录接口

1 前后端项目上传到gitee 2 后端多方式登录接口 2.1 序列化类 2.2 视图类 2.3 路由 3 发送短信功能 4 发送短信封装 4.0 目录结构 4.1 settings.py 4.2 sms.py 5 短信验证码接口 6 短信登录接口 6.1 视图类 6.2 序列化类 1 前后端项目上传到gitee # 我们看到好多开源项目…...

046:mapboxGL加载天地图路网图+标记(wmts方式)

第046个 点击查看专栏目录 本示例的目的是介绍演示如何在vue+mapbox中加载天地图路网图+标记(wmts方式)。瓦片中的url地址引用的是天地图的wmts的形式。 直接复制下面的 vue+mapbox源代码,操作2分钟即可运行实现效果 文章目录 示例效果配置方式示例源代码(共99行)相关AP…...

【ICer的脚本练习】tcl语法熟悉和工具tcl的实例

系列的目录说明请见:ICer的脚本练习专栏介绍与全流程目录_尼德兰的喵的博客-CSDN博客 前言 TCL(Tool Command Language)是一种简单但功能强大的脚本语言,它经常用于自动化任务、测试和快速原型开发。你看这个名字就能知道,这个语言最主要的作用就是用来操作工具,尤其我们…...

uniapp+vue3+ts+uview-plus搭建项目步骤

创建项目 使用Vue3/Vite版&#xff0c;创建以 typescript 开发的工程 下载仓库 DCloud/uni-preset-vue - Gitee.com node版本&#xff1a;v16.18.0 npm版本&#xff1a; v8.19.2 依赖下载 解压之后&#xff0c;在vscode打开 通过终端运行 npm 命令下载依赖&#xff1a;npm ins…...

在PHP中,可以使用不同的加密算法(如MD5、SHA1、SHA256)结合RSA算法进行公钥加密和私钥解密。

下面是使用这三种算法进行加密和解密的示例代码&#xff1a; // 生成RSA密钥对 $keyPair openssl_pkey_new(array(private_key_bits > 2048,private_key_type > OPENSSL_KEYTYPE_RSA, ));// 获取私钥和公钥 openssl_pkey_export($keyPair, $privateKey); $publicKey o…...

第六章:路由交换机及操作系统

路由交换机及操作系统 一、路由器与交换机的作用与特点1.路由器1.1 作用1.2 特点 2.交换机2.1 作用2.2 特点 二、H3C路由器与交换机介绍1. 路由器2. 交换机 三、 H3C网络设备操作系统Comware1. 介绍2. 特点![在这里插入图片描述](https://img-blog.csdnimg.cn/2b24103028654878…...

Kafka SASL认证授权(六)全方位性能测试

Kafka SASL认证授权(六)全方位性能测试。 官网地址:https://kafka.apache.org/ 一、场景 线上已经有kafka集群,服务运行稳定。但是因为产品升级,需要对kakfa做安全测试,也就是权限验证。 但是增加权限验证,会不会对性能有影响呢?影响大吗?不知道呀! 因此,本文就此…...

基于nodejs+vue校园失物招领平台设计与实现

科学技术日新月异的如今&#xff0c;计算机在生活各个领域都占有重要的作用&#xff0c;尤其在信息管理方面&#xff0c;在这样的大背景下&#xff0c;学习计算机知识不仅仅是为了掌握一种技能&#xff0c;更重要的是能够让它真正地使用到实目 录 摘 要 I ABSTRACT II 目 录 II…...

Open Winding-PMSM-开绕组永磁同步电机基本介绍

文章目录 前言简介Open Widing电机数学模型零序模型 双逆变器调制零序电流抑制基本思路 前言 最近看了些Open Winding永磁同步电机及其控制策略的文献资料&#xff0c;现做个总结。未来的研究方向也大概率围绕Open Winding开展&#xff0c;期待同行交流学习。 简介 开绕组(O…...

uniapp 一次性上传多条视频 u-upload accept=“video“ uni.chooseMedia uni.uploadFile

方式 一 部分安卓机 只能一条一条传视频 文档地址 uview 2.0 Upload 上传组件 html <view class"formupload"><u-upload accept"video":fileList"fileList3" afterRead"afterRead" delete"deletePic" name"…...

CentOS7卸载硬盘报错:umount: /data: target is busy.

问题描述 umount: /data: target is busy. 问题分析 硬盘正在被使用&#xff0c;不能被卸载。 解决方案 查看哪些程序在使用硬盘 [rootlocalhost ~]# lsof /data/ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 15655 polkitd cwd …...

Chrome插件精选 — 鼠标手势插件

Chrome实现同一功能的插件往往有多款产品&#xff0c;逐一去安装试用耗时又费力&#xff0c;在此为某一类型插件记录下比较好用的一款或几款&#xff0c;便于节省尝试的时间和精力。 下面是两款比较好用的鼠标手势插件&#xff0c;支持很多设置选项&#xff0c;可以自定义手势&…...

JMeter分布式

一 分布式注意事项 关闭防火墙控制机和代理机在同一子网控制机和代理机上安装的jmeter和JDK版本要一样关闭jmeter的RMI SSL开关 二 代理机&#xff08;agent&#xff09;的配置 修改服务端口 打开bin/jmeter.properties文件&#xff0c;修改’server_port’ 将RMI SSL设备…...

[华为杯研究生创新赛 2023] 初赛 REV WP

前言 一年没打比赛了, 差一题进决赛, REV当时lin的第三个challenge没看出来是凯撒, 想得复杂了, 结果错失一次线下机会 >_< T4ee 动态调试, nop掉反调试代码 发现处理过程为 置换sub_412F20处理(这里看其他师傅的wp知道应该是rc4, 我是直接en逆的buf字符串中每一位和…...

C++中resize和reserve

1.reserve(n)对capacity操作 capacity < n : 扩容capacity > n : 不操作 2.resize(n, m)对size操作 size < n : size增加到n 增加的值为msize > n : size减小到ncapacity < n : 先增大容量至n 再增大size至n 增加的值为m...

【面试经典150 | 哈希表】存在重复元素 II

文章目录 Tag题目来源题目解读解题思路方法一&#xff1a;哈希表方法二&#xff1a;滑动窗口 其他语言python3哈希表python3滑动窗口 写在最后 Tag 【哈希表】【滑动窗口】【数组】 题目来源 219. 存在重复元素 II 题目解读 判断在数组中有没有相同的元素小于一定的距离。 解…...

Wan2.2-I2V-A14B企业落地:汽车4S店车型介绍短视频自动化生产系统

Wan2.2-I2V-A14B企业落地&#xff1a;汽车4S店车型介绍短视频自动化生产系统 1. 项目背景与需求分析 汽车4S店每天需要为不同车型制作大量介绍视频&#xff0c;传统视频制作方式面临三大痛点&#xff1a; 人力成本高&#xff1a;专业视频团队制作单条视频成本约2000-5000元制…...

ViGEmBus虚拟手柄驱动:如何让任何设备变身Xbox 360或PS4控制器

ViGEmBus虚拟手柄驱动&#xff1a;如何让任何设备变身Xbox 360或PS4控制器 【免费下载链接】ViGEmBus Windows kernel-mode driver emulating well-known USB game controllers. 项目地址: https://gitcode.com/gh_mirrors/vi/ViGEmBus 在Windows游戏生态中&#xff0c;…...

ABAP - MEMORY ID 的跨程序数据共享实践

1. ABAP内存ID&#xff1a;跨程序数据共享的秘密武器 在SAP开发中&#xff0c;经常会遇到这样的场景&#xff1a;程序A需要某些数据&#xff0c;但获取这些数据的逻辑写在程序B里。传统做法可能是通过接口、数据库表或者文件来中转数据&#xff0c;但这些方法要么太麻烦&#x…...

Minecraft世界修复全攻略:从数据损坏到完整恢复的专业解决方案

Minecraft世界修复全攻略&#xff1a;从数据损坏到完整恢复的专业解决方案 【免费下载链接】Minecraft-Region-Fixer Python script to fix some of the problems of the Minecraft save files (region files, *.mca). 项目地址: https://gitcode.com/gh_mirrors/mi/Minecraf…...

4大核心能力赋能企业级视频资源管理:抖音批量下载工具的技术实现与商业价值

4大核心能力赋能企业级视频资源管理&#xff1a;抖音批量下载工具的技术实现与商业价值 【免费下载链接】douyin-downloader 项目地址: https://gitcode.com/GitHub_Trending/do/douyin-downloader 在数字化内容爆发的时代&#xff0c;企业级视频资源管理面临着效率与成…...

ICML 2026 开分!投稿群来了!还有IJCAI、CVPR 2026投稿群!

点击下方卡片&#xff0c;关注“CVer”公众号AI/CV重磅干货&#xff0c;第一时间送达点击进入—>【顶会/顶刊】投稿交流群添加微信&#xff1a;CVer2233&#xff0c;助手会拉你进群&#xff01;扫描下方二维码&#xff0c;加入CVer学术星球&#xff01;可获得最新顶会/顶刊上…...

Lingbot-Depth-Pretrain-VitL-14处理复杂光照与反射场景效果展示

Lingbot-Depth-Pretrain-VitL-14处理复杂光照与反射场景效果展示 深度估计技术&#xff0c;简单来说就是让计算机像人眼一样&#xff0c;判断出画面中每个物体离我们有多远。这项技术在自动驾驶、机器人导航、增强现实等领域都扮演着关键角色。然而&#xff0c;当场景中出现一…...

PaddleOCR-VL-1.5:0.9B VLM实现文档解析新SOTA

PaddleOCR-VL-1.5&#xff1a;0.9B VLM实现文档解析新SOTA 【免费下载链接】PaddleOCR-VL-1.5-GGUF 项目地址: https://ai.gitcode.com/paddlepaddle/PaddleOCR-VL-1.5-GGUF 导语&#xff1a;百度飞桨团队推出PaddleOCR-VL-1.5&#xff0c;以0.9B参数量的轻量化视觉语言…...

s2-pro语音合成教程:通过API批量提交任务+异步结果回调实现

s2-pro语音合成教程&#xff1a;通过API批量提交任务异步结果回调实现 1. 平台简介 s2-pro是Fish Audio开源的专业级语音合成模型镜像&#xff0c;它能够将文本转换为自然流畅的语音。这个工具特别适合需要批量处理语音合成任务的场景&#xff0c;比如有声书制作、客服语音生…...

OpenClaw+GLM-4.7-Flash学习助手:自动整理课程笔记与生成复习题

OpenClawGLM-4.7-Flash学习助手&#xff1a;自动整理课程笔记与生成复习题 1. 为什么需要自动化学习助手&#xff1f; 去年备考研究生时&#xff0c;我每天要处理3-4小时的课程视频。最痛苦的不是听课本身&#xff0c;而是课后整理&#xff1a;手动截取关键片段、转录字幕、标…...