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

Boost笔记 1:下载、编译、安装、测试

1. 下载

当前版本是1.82,下载链接:
https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/

2. 安装编译依赖库

本地环境是Ubuntu 22.04,需要安装以下依赖库,部分影响boost相关功能的开启,部分影响编译过程。
本地环境编译AOSP源码,安装过相关依赖库,除了这里列出的可能还需要其他依赖库,可根据提示安装。
sudo apt install icu-devtools libicu-dev libbz2-dev liblzma-dev libzstd-dev python3-dev python2-dev -y

2.1 解压

解压后源码文件夹:

boost_1_82_0$ ls
boost            boost.css      bootstrap.sh  index.html  libs             README.md  tools
boost-build.jam  boost.png      doc           INSTALL     LICENSE_1_0.txt  rst.css
boostcpp.jam     bootstrap.bat  index.htm     Jamroot     more             status

2.2 执行bootstrap.sh脚本,生成b2编译工具

1)执行bootstrap.sh后,源码目录下增加b2和project-config.jam两个文件。
2)b2工具是用来编译和安装boost库。
(1)查看帮助:b2 --help
(2)编译:b2
(3)clean:b2 --clean
(4)安装:b2 install
(5)重新配置编译脚本:b2 --reconfigure
如果编译失败或者过程中发现缺少一些依赖库及boost相关模块,安装依赖库后,需要执行这个命令重新检测依赖并生成编译脚本。

$ ./bootstrap.sh 
Building B2 engine..###
###
### Using 'gcc' toolset.
###
###g++ (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.###
###> 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 b2
> tools/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 headersThe configuration generated uses gcc to build by default. If that is
unintended either use the --with-toolset option or adjust configuration, by
editing 'project-config.jam'.Further information:- Command line help:./b2 --help- Getting started guide: http://www.boost.org/more/getting_started/unix-variants.html- B2 documentation:http://www.boost.org/build/

2.3 编译和安装

1)执行b2命令编译源码,先检测编译依赖,然后根据依赖配置进行编译。
2)成功编译后,安装:b2 install。
默认安装路径为:/usr/local/include/boost 和 /usr/local/lib/

$ ./b2
Performing configuration checks- default address-model    : 64-bit [1]- default architecture     : x86 [1]Building the Boost C++ Libraries.- 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                : yes [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 POSIX *at APIs       : yes [2]- cxx11_auto_declarations  : yes [2]- cxx11_constexpr          : yes [2]- cxx11_defaulted_functions : yes [2]- cxx11_final              : yes [2]- cxx11_hdr_mutex          : yes [2]- cxx11_hdr_tuple          : yes [2]- cxx11_lambdas            : yes [2]- cxx11_noexcept           : yes [2]- cxx11_nullptr            : yes [2]- cxx11_rvalue_references  : yes [2]- cxx11_template_aliases   : yes [2]- cxx11_thread_local       : yes [2]...(检测编译依赖)Component configuration:- atomic                   : building- chrono                   : building- container                : building- context                  : building- contract                 : building- coroutine                : building- date_time                : building- exception                : building- fiber                    : building- filesystem               : building- graph                    : building- graph_parallel           : building- headers                  : building- iostreams                : building- json                     : building- locale                   : building- log                      : building- math                     : building- mpi                      : building- nowide                   : building- program_options          : building- python                   : building- random                   : building- regex                    : building- serialization            : building- stacktrace               : building- system                   : building- test                     : building- thread                   : building- timer                    : building- type_erasure             : building- url                      : building- wave                     : building...patience...
...patience...
...found 18844 targets...
...updating 1767 targets...... (编译源码)common.copy /home/dev/github/boost/temp/boost_1_82_0/stage/lib/libboost_wave.a
...updated 1767 targets...The Boost C++ Libraries were successfully built!The following directory should be added to compiler include paths:/home/dev/github/boost/temp/boost_1_82_0The following directory should be added to linker library paths:/home/dev/github/boost/temp/boost_1_82_0/stage/lib

2.4 测试程序

安装后,不用指定include和library path,编译时可自动搜索到。
以下测试程序可用clion或者命令行编译:

$ g++ -o main main.cpp
#include <string>
#include <iostream>
#include <boost/foreach.hpp>int main()
{std::string hello( "Hello, world!" );BOOST_FOREACH( char ch, hello ){std::cout << ch;}return 0;
}

2.5 CMake依赖

在cmake脚本中使用find_package显示引用boost:

find_package(Boost 1.82 REQUIRED COMPONENTS filesystem regex PATHS C:/Boost)
find_package(Boost 1.82 REQUIRED COMPONENTS ALL)
find_package(Boost 1.82 REQUIRED ALL)

相关文章:

Boost笔记 1:下载、编译、安装、测试

1. 下载 当前版本是1.82&#xff0c;下载链接&#xff1a; https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/ 2. 安装编译依赖库 本地环境是Ubuntu 22.04&#xff0c;需要安装以下依赖库&#xff0c;部分影响boost相关功能的开启&#xff0c;部分影响编译…...

tiechui_lesson01_入口函数和卸载函数

主要讲解入口函数和卸载函数。 #include <ntifs.h>VOID nothing(HANDLE ppid, HANDLE mypid, BOOLEAN bcreate) {UNREFERENCED_PARAMETER(ppid);UNREFERENCED_PARAMETER(mypid);UNREFERENCED_PARAMETER(bcreate);DbgPrint("processNotify\n"); }VOID DriverU…...

密码学【java】初探究加密方式之非对称加密

文章目录 非对称加密1 常见算法2 生成公钥和私钥3 私钥加密4 私钥加密 公钥解密5 公钥和私钥的保存和读取5.1 **保存公钥和私钥**5.2 读取公钥和私钥 非对称加密 非对称加密算法又称现代加密算法。非对称加密是计算机通信安全的基石&#xff0c;保证了加密数据不会被破解。与对…...

网络安全和黑客技能:15本必读书籍推荐

前言 网络安全和黑客技能紧密相连。想要有效地防范黑客攻击&#xff0c;了解黑客的技能和思维方式非常重要。而要想成为一名合格的白帽黑客&#xff0c;也需要深入理解网络安全的基本原理和最佳实践。本文将介绍15本网络安全和黑客书籍&#xff0c;既包括了防范黑客攻击的指南…...

电话号码的字母组合

题目&#xff1a;17. 电话号码的字母组合 - 力扣&#xff08;Leetcode&#xff09; 思路&#xff1a; 给定一个电话号码字符串 digits&#xff0c;须输出它所能表示的所有字母组合。我们可以先定义一个数字字符到字母表的映射表 numToStr&#xff0c;然后再用 Combine 函数递归…...

PAT A1032 Sharing

1032 Sharing 分数 25 作者 CHEN, Yue 单位 浙江大学 To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example, l…...

Git常见问题汇总

问题&#xff1a;Your branch is ahead of ‘origin/master’ by 1 commit 原因&#xff1a;你的本地分支高于远程仓库一次提交, 同步更新下&#xff0c;执行命令&#xff1a; git push origin master问题&#xff1a;warning: LF will be replaced by CRLF in main.lua The …...

设计模式之代理模式(静态代理动态代理)

目录 1、什么是代理模式 2、代理模式的结构 3、代理模式的实现 3.1 静态代理和动态代理概念 3.2 静态代理 3.3 动态搭理 3.3.1 代码实现 3.3.2 Proxy类讲解 4、动态代理VS静态代理 5、代理模式优缺点 1、什么是代理模式 由于某些原因需要给某对象提供一个代理以控制对…...

Java并发编程基础知识概述

前言 在现代计算机系统和服务器中&#xff0c;多线程并行执行已经成为常态&#xff0c;而且并发编程能够充分利用系统资源&#xff0c;提高程序处理效率和质量。因此&#xff0c;Java并发编程是Java程序员必须掌握的重要技能之一。 线程和进程 在操作系统中&#xff0c;进程是…...

Redis超详细入门手册教程!还不快来看看?

地址&#xff1a; RedisRedis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures …https://redis.io/ 1&#xff1a;NoSQL简介 1.1&#xff1a;数据库应用的演变历程 单…...

代码随想录算法训练营第四十九天| 121. 买卖股票的最佳时机、122.买卖股票的最佳时机II

文章目录 121. 买卖股票的最佳时机122.买卖股票的最佳时机II 121. 买卖股票的最佳时机 为什么定义dp数组为二维数组&#xff1f; dp数组定义&#xff0c;dp(i)[0] 表示第i天持有股票所得最多现金&#xff0c;dp(i)[1]表示第i天不持有股票的状态&#xff08;未必当前卖出&#x…...

零基础如何学习挖漏洞?看这篇就够了【网络安全】

前言 有不少阅读过我文章的伙伴都知道&#xff0c;我从事网络安全行业已经好几年&#xff0c;积累了丰富的经验和技能。在这段时间里&#xff0c;我参与了多个实际项目的规划和实施&#xff0c;成功防范了各种网络攻击和漏洞利用&#xff0c;提高了安全防护水平。 也有很多小…...

Twitter 推荐算法底有多牛? 已斩获11.7K star

点击上方“Github中文社区”&#xff0c;关注 看Github&#xff0c;每天提升第070期分享 &#xff0c;作者&#xff1a;Huber | Github中文社区 大家好&#xff0c;我是Huber。 在美国当地时间 3 月 31 日&#xff0c;马斯克履行当初的诺言&#xff0c;他宣布了 Twitter 算法的…...

看过这篇文章,读懂数据分析

一、为什么需要数据分析 数据分析的重要性不言而喻&#xff0c;没有数据&#xff0c;就是感性。数据不会被观点打败&#xff0c;数据只能被数据打败。我们现在妥妥地已经进入了数据时代。 量化IT投资成效&#xff0c;以数据驱动决策 站在公司或者决策者角度&#xff0c;数据最…...

[计算机图形学]光场,颜色与感知(前瞻预习/复习回顾)

一、Light Field / Lumigraph—光场 1.我们看到的是什么 我们的眼睛能够把3D世界转换为2D的成像信号被我们感知&#xff0c;如上面第一幅图&#xff0c;这就是我们看到整个世界的过程&#xff0c;那么如果我们把之前记录的光的信息都完美的放在一个幕布上&#xff0c;那么我们…...

L4公司进军辅助驾驶,放话无图也能跑遍中国

作者 | Amy 编辑 | 德新 高阶智能驾驶走向规模量产&#xff0c;高精地图成为关键的门槛之一。今年&#xff0c;多家车企和智驾公司都喊出「不依赖高精地图&#xff0c;快速大规模落地」的口号。 华为、小鹏、元戎以及毫末等&#xff0c;可能是最快在国内量产 无高精图智…...

【Java笔试强训 17】

&#x1f389;&#x1f389;&#x1f389;点进来你就是我的人了博主主页&#xff1a;&#x1f648;&#x1f648;&#x1f648;戳一戳,欢迎大佬指点! 欢迎志同道合的朋友一起加油喔&#x1f93a;&#x1f93a;&#x1f93a; 目录 一、选择题 二、编程题 &#x1f525;杨辉三角…...

【IPv6】基本概念及字段

IPV4知识点&#xff1a; 字段值 IPv4字段共 字段值解释Version版本版本字段&#xff0c;可以区分V4和V6版本&#xff0c;V4是0100&#xff0c;V6是0110&#xff0c;需要注意的是V4和V6头部除了版本字段位置相同外&#xff0c;其他都是不一样的&#xff0c;因此两个协议不能直…...

数据库中的 Schema 变更实现

线上沙龙-技术流第 30 期营业啦 05月09日&#xff08;周二&#xff09;19:30 KaiwuDB - B站直播间 传统数据库操作 Schema 变更时&#xff0c;第一步便是锁表&#xff0c;需持续到 Schema 变更操作完成。这样的做法虽然实现简单&#xff0c;无需考虑事务并发带来的影响&#…...

【C++ 学习 ②】- 类和对象(上)

目录 一、 面向对象的基本理念 1.1 - 什么是对象&#xff1f; 1.2 - 类和对象 1.3 - 面向对象的五条原则 1.4 - 面向过程 vs 面向对象 二、C 中的结构体 三、类的定义 3.1 - 类的两种定义方式 3.2 - 成员变量的命名规范 四、类的访问限定符和封装 4.1 - 访问限定符 …...

vscode里如何用git

打开vs终端执行如下&#xff1a; 1 初始化 Git 仓库&#xff08;如果尚未初始化&#xff09; git init 2 添加文件到 Git 仓库 git add . 3 使用 git commit 命令来提交你的更改。确保在提交时加上一个有用的消息。 git commit -m "备注信息" 4 …...

基于大模型的 UI 自动化系统

基于大模型的 UI 自动化系统 下面是一个完整的 Python 系统,利用大模型实现智能 UI 自动化,结合计算机视觉和自然语言处理技术,实现"看屏操作"的能力。 系统架构设计 #mermaid-svg-2gn2GRvh5WCP2ktF {font-family:"trebuchet ms",verdana,arial,sans-…...

Lombok 的 @Data 注解失效,未生成 getter/setter 方法引发的HTTP 406 错误

HTTP 状态码 406 (Not Acceptable) 和 500 (Internal Server Error) 是两类完全不同的错误&#xff0c;它们的含义、原因和解决方法都有显著区别。以下是详细对比&#xff1a; 1. HTTP 406 (Not Acceptable) 含义&#xff1a; 客户端请求的内容类型与服务器支持的内容类型不匹…...

golang循环变量捕获问题​​

在 Go 语言中&#xff0c;当在循环中启动协程&#xff08;goroutine&#xff09;时&#xff0c;如果在协程闭包中直接引用循环变量&#xff0c;可能会遇到一个常见的陷阱 - ​​循环变量捕获问题​​。让我详细解释一下&#xff1a; 问题背景 看这个代码片段&#xff1a; fo…...

从零开始打造 OpenSTLinux 6.6 Yocto 系统(基于STM32CubeMX)(九)

设备树移植 和uboot设备树修改的内容同步到kernel将设备树stm32mp157d-stm32mp157daa1-mx.dts复制到内核源码目录下 源码修改及编译 修改arch/arm/boot/dts/st/Makefile&#xff0c;新增设备树编译 stm32mp157f-ev1-m4-examples.dtb \stm32mp157d-stm32mp157daa1-mx.dtb修改…...

linux 下常用变更-8

1、删除普通用户 查询用户初始UID和GIDls -l /home/ ###家目录中查看UID cat /etc/group ###此文件查看GID删除用户1.编辑文件 /etc/passwd 找到对应的行&#xff0c;YW343:x:0:0::/home/YW343:/bin/bash 2.将标红的位置修改为用户对应初始UID和GID&#xff1a; YW3…...

CRMEB 框架中 PHP 上传扩展开发:涵盖本地上传及阿里云 OSS、腾讯云 COS、七牛云

目前已有本地上传、阿里云OSS上传、腾讯云COS上传、七牛云上传扩展 扩展入口文件 文件目录 crmeb\services\upload\Upload.php namespace crmeb\services\upload;use crmeb\basic\BaseManager; use think\facade\Config;/*** Class Upload* package crmeb\services\upload* …...

微软PowerBI考试 PL300-在 Power BI 中清理、转换和加载数据

微软PowerBI考试 PL300-在 Power BI 中清理、转换和加载数据 Power Query 具有大量专门帮助您清理和准备数据以供分析的功能。 您将了解如何简化复杂模型、更改数据类型、重命名对象和透视数据。 您还将了解如何分析列&#xff0c;以便知晓哪些列包含有价值的数据&#xff0c;…...

【VLNs篇】07:NavRL—在动态环境中学习安全飞行

项目内容论文标题NavRL: 在动态环境中学习安全飞行 (NavRL: Learning Safe Flight in Dynamic Environments)核心问题解决无人机在包含静态和动态障碍物的复杂环境中进行安全、高效自主导航的挑战&#xff0c;克服传统方法和现有强化学习方法的局限性。核心算法基于近端策略优化…...

C++.OpenGL (20/64)混合(Blending)

混合(Blending) 透明效果核心原理 #mermaid-svg-SWG0UzVfJms7Sm3e {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-SWG0UzVfJms7Sm3e .error-icon{fill:#552222;}#mermaid-svg-SWG0UzVfJms7Sm3e .error-text{fill…...