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之外,还需要两个开发库:bzip2-devel 和python-devel ,因此在安装前应该先保证这两个库已经安装。 安装指令: yum install bzip2 bzip2-devel bzip2-libs python-devel Cent…...
vue图表制作
Vue.js是一个非常流行的JavaScript框架,可以用于开发交互式Web应用程序。Vue.js的优点之一是它的灵活性和可扩展性。因此,可以使用Vue.js与许多其他库和框架集成,包括图表库。 下面是使用Vue.js制作图表的一些步骤: 1.选择一个适…...
使用 GitHub Action 自动更新 Sealos 集群的应用镜像
在 IT 领域,自动化无疑已成为提高工作效率和减少人为错误的关键。Sealos 作为一个强大的云操作系统,已经为许多企业和开发者提供了稳定可靠的服务。与此同时,随着技术不断发展,集成更多的功能和服务变得尤为重要。考虑到这一点&am…...
windows频繁更新问题解决方案
解决方案:将更新策略增加到无穷大 1.windowsr 输入regedit 2.找到:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings 3.右键新建DWORD32 4.命名:FlightSettingsMaxPauseDays 5.双击:数值数据改为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版,创建以 typescript 开发的工程 下载仓库 DCloud/uni-preset-vue - Gitee.com node版本:v16.18.0 npm版本: v8.19.2 依赖下载 解压之后,在vscode打开 通过终端运行 npm 命令下载依赖:npm ins…...
在PHP中,可以使用不同的加密算法(如MD5、SHA1、SHA256)结合RSA算法进行公钥加密和私钥解密。
下面是使用这三种算法进行加密和解密的示例代码: // 生成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. 特点全方位性能测试
Kafka SASL认证授权(六)全方位性能测试。 官网地址:https://kafka.apache.org/ 一、场景 线上已经有kafka集群,服务运行稳定。但是因为产品升级,需要对kakfa做安全测试,也就是权限验证。 但是增加权限验证,会不会对性能有影响呢?影响大吗?不知道呀! 因此,本文就此…...
基于nodejs+vue校园失物招领平台设计与实现
科学技术日新月异的如今,计算机在生活各个领域都占有重要的作用,尤其在信息管理方面,在这样的大背景下,学习计算机知识不仅仅是为了掌握一种技能,更重要的是能够让它真正地使用到实目 录 摘 要 I ABSTRACT II 目 录 II…...
Open Winding-PMSM-开绕组永磁同步电机基本介绍
文章目录 前言简介Open Widing电机数学模型零序模型 双逆变器调制零序电流抑制基本思路 前言 最近看了些Open Winding永磁同步电机及其控制策略的文献资料,现做个总结。未来的研究方向也大概率围绕Open Winding开展,期待同行交流学习。 简介 开绕组(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. 问题分析 硬盘正在被使用,不能被卸载。 解决方案 查看哪些程序在使用硬盘 [rootlocalhost ~]# lsof /data/ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME mysqld 15655 polkitd cwd …...
Chrome插件精选 — 鼠标手势插件
Chrome实现同一功能的插件往往有多款产品,逐一去安装试用耗时又费力,在此为某一类型插件记录下比较好用的一款或几款,便于节省尝试的时间和精力。 下面是两款比较好用的鼠标手势插件,支持很多设置选项,可以自定义手势&…...
JMeter分布式
一 分布式注意事项 关闭防火墙控制机和代理机在同一子网控制机和代理机上安装的jmeter和JDK版本要一样关闭jmeter的RMI SSL开关 二 代理机(agent)的配置 修改服务端口 打开bin/jmeter.properties文件,修改’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题目来源题目解读解题思路方法一:哈希表方法二:滑动窗口 其他语言python3哈希表python3滑动窗口 写在最后 Tag 【哈希表】【滑动窗口】【数组】 题目来源 219. 存在重复元素 II 题目解读 判断在数组中有没有相同的元素小于一定的距离。 解…...
(LeetCode 每日一题) 3442. 奇偶频次间的最大差值 I (哈希、字符串)
题目:3442. 奇偶频次间的最大差值 I 思路 :哈希,时间复杂度0(n)。 用哈希表来记录每个字符串中字符的分布情况,哈希表这里用数组即可实现。 C版本: class Solution { public:int maxDifference(string s) {int a[26]…...
PPT|230页| 制造集团企业供应链端到端的数字化解决方案:从需求到结算的全链路业务闭环构建
制造业采购供应链管理是企业运营的核心环节,供应链协同管理在供应链上下游企业之间建立紧密的合作关系,通过信息共享、资源整合、业务协同等方式,实现供应链的全面管理和优化,提高供应链的效率和透明度,降低供应链的成…...
【SpringBoot】100、SpringBoot中使用自定义注解+AOP实现参数自动解密
在实际项目中,用户注册、登录、修改密码等操作,都涉及到参数传输安全问题。所以我们需要在前端对账户、密码等敏感信息加密传输,在后端接收到数据后能自动解密。 1、引入依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId...
解锁数据库简洁之道:FastAPI与SQLModel实战指南
在构建现代Web应用程序时,与数据库的交互无疑是核心环节。虽然传统的数据库操作方式(如直接编写SQL语句与psycopg2交互)赋予了我们精细的控制权,但在面对日益复杂的业务逻辑和快速迭代的需求时,这种方式的开发效率和可…...
【磁盘】每天掌握一个Linux命令 - iostat
目录 【磁盘】每天掌握一个Linux命令 - iostat工具概述安装方式核心功能基础用法进阶操作实战案例面试题场景生产场景 注意事项 【磁盘】每天掌握一个Linux命令 - iostat 工具概述 iostat(I/O Statistics)是Linux系统下用于监视系统输入输出设备和CPU使…...
linux arm系统烧录
1、打开瑞芯微程序 2、按住linux arm 的 recover按键 插入电源 3、当瑞芯微检测到有设备 4、松开recover按键 5、选择升级固件 6、点击固件选择本地刷机的linux arm 镜像 7、点击升级 (忘了有没有这步了 估计有) 刷机程序 和 镜像 就不提供了。要刷的时…...
rnn判断string中第一次出现a的下标
# coding:utf8 import torch import torch.nn as nn import numpy as np import random import json""" 基于pytorch的网络编写 实现一个RNN网络完成多分类任务 判断字符 a 第一次出现在字符串中的位置 """class TorchModel(nn.Module):def __in…...
Yolov8 目标检测蒸馏学习记录
yolov8系列模型蒸馏基本流程,代码下载:这里本人提交了一个demo:djdll/Yolov8_Distillation: Yolov8轻量化_蒸馏代码实现 在轻量化模型设计中,**知识蒸馏(Knowledge Distillation)**被广泛应用,作为提升模型…...
R 语言科研绘图第 55 期 --- 网络图-聚类
在发表科研论文的过程中,科研绘图是必不可少的,一张好看的图形会是文章很大的加分项。 为了便于使用,本系列文章介绍的所有绘图都已收录到了 sciRplot 项目中,获取方式: R 语言科研绘图模板 --- sciRplothttps://mp.…...
深入理解Optional:处理空指针异常
1. 使用Optional处理可能为空的集合 在Java开发中,集合判空是一个常见但容易出错的场景。传统方式虽然可行,但存在一些潜在问题: // 传统判空方式 if (!CollectionUtils.isEmpty(userInfoList)) {for (UserInfo userInfo : userInfoList) {…...
