【C++】CentOS环境搭建-编译安装Boost库(附CMAKE编译文件)

【C++】环境搭建-编译安装Boost库

  • Boost库简介
  • Boost库安装
    • 通过YUM安装(版本较低 V1.53.0)
    • 通过编译安装(官网最新版本1.85.0)
      • 1.安装相关依赖
      • 2.查询官网下载最新安装包并解压
      • 3.编译Boost
      • 4.安装Boost库到系统路径
  • Boost库验证

Boost库简介

Boost库是为C++语言标准库提供扩展的一些C++程序库的总称。
Boost库由Boost社区组织开发、维护。其目的是为C++程序员提供免费、同行审查的、可移植的程序库。Boost库可以与C++标准库共同工作,并且为其提供扩展功能。Boost库使用Boost License来授权使用,根据该协议,商业或非商业的使用都是允许并鼓励的。
Boost社区建立的初衷之一就是为C++的标准化工作提供可供参考的实现,Boost社区的发起人Dawes本人就是C++标准委员会的成员之一。在Boost库的开发中,Boost社区也在这个方向上取得了丰硕的成果。在送审的C++标准库TR1中,有十个Boost库成为标准库的候选方案。在更新的TR2中,有更多的Boost库被加入到其中。从某种意义上来讲,Boost库成为具有实践意义的准标准库。
大部分boost库功能的使用只需包括相应头文件即可,少数(如正则表达式库,文件系统库等)需要链接库。里面有许多具有工业强度的库,如graph库。
很多Boost中的库功能堪称对语言功能的扩展,其构造用尽精巧的手法,不要贸然的花费时间研读。Boost另外一面,比如Graph这样的库则是具有工业强度,结构良好,非常值得研读的精品代码,并且也可以放心的在产品代码中多多利用。

Boost库安装

通过YUM安装(版本较低 V1.53.0)

  1. 升级YUM到最新版本
sudo yum update
  1. 安装boost开发版
sudo yum install boost-devel

安装效果如下:

[root@localhost ~]# sudo yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.x86_64 1:1.18.8-1.el7 will be updated
---> Package NetworkManager.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package NetworkManager-libnm.x86_64 1:1.18.8-1.el7 will be updated
---> Package NetworkManager-libnm.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package NetworkManager-team.x86_64 1:1.18.8-1.el7 will be updated
---> Package NetworkManager-team.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package NetworkManager-tui.x86_64 1:1.18.8-1.el7 will be updated
---> Package NetworkManager-tui.x86_64 1:1.18.8-2.el7_9 will be an update
---> Package bash.x86_64 0:4.2.46-34.el7 will be updated
---> Package bash.x86_64 0:4.2.46-35.el7_9 will be an update
---> Package bind-export-libs.x86_64 32:9.11.4-26.P2.el7 will be updated
---> Package bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.15 will be an update
---> Package binutils.x86_64 0:2.27-44.base.el7 will be updated
---> Package binutils.x86_64 0:2.27-44.base.el7_9.1 will be an update
---> Package ca-certificates.noarch 0:2020.2.41-70.0.el7_8 will be updated
---> Package ca-certificates.noarch 0:2023.2.60_v7.0.306-72.el7_9 will be an update
---> Package centos-release.x86_64 0:7-9.2009.0.el7.centos will be updated
---> Package centos-release.x86_64 0:7-9.2009.1.el7.centos will be an update
---> Package coreutils.x86_64 0:8.22-24.el7 will be updated
---> Package coreutils.x86_64 0:8.22-24.el7_9.2 will be an update
---> Package cronie.x86_64 0:1.4.11-23.el7 will be updated
---> Package cronie.x86_64 0:1.4.11-25.el7_9 will be an update
---> Package cronie-anacron.x86_64 0:1.4.11-23.el7 will be updated
---> Package cronie-anacron.x86_64 0:1.4.11-25.el7_9 will be an update
---> Package cyrus-sasl-lib.x86_64 0:2.1.26-23.el7 will be updated
---> Package cyrus-sasl-lib.x86_64 0:2.1.26-24.el7_9 will be an update
---> Package device-mapper.x86_64 7:1.02.170-6.el7 will be updated
---> Package device-mapper.x86_64 7:1.02.170-6.el7_9.5 will be an update
---> Package device-mapper-event.x86_64 7:1.02.170-6.el7 will be updated
---> Package device-mapper-event.x86_64 7:1.02.170-6.el7_9.5 will be an update
---> Package device-mapper-event-libs.x86_64 7:1.02.170-6.el7 will be updated
---> Package device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5 will be an update
---> Package device-mapper-libs.x86_64 7:1.02.170-6.el7 will be updated
---> Package device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5 will be an update
---> Package device-mapper-persistent-data.x86_64 0:0.8.5-3.el7 will be updated
---> Package device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2 will be an update
---> Package dhclient.x86_64 12:4.2.5-82.el7.centos will be updated
---> Package dhclient.x86_64 12:4.2.5-83.el7.centos.1 will be an update
---> Package dhcp-common.x86_64 12:4.2.5-82.el7.centos will be updated
---> Package dhcp-common.x86_64 12:4.2.5-83.el7.centos.1 will be an update
---> Package dhcp-libs.x86_64 12:4.2.5-82.el7.centos will be updated
---> Package dhcp-libs.x86_64 12:4.2.5-83.el7.centos.1 will be an update
---> Package diffutils.x86_64 0:3.3-5.el7 will be updated
---> Package diffutils.x86_64 0:3.3-6.el7_9 will be an update
---> Package dmidecode.x86_64 1:3.2-5.el7 will be updated
---> Package dmidecode.x86_64 1:3.2-5.el7_9.1 will be an update
---> Package firewalld.noarch 0:0.6.3-11.el7 will be updated
---> Package firewalld.noarch 0:0.6.3-13.el7_9 will be an update
---> Package firewalld-filesystem.noarch 0:0.6.3-11.el7 will be updated
---> Package firewalld-filesystem.noarch 0:0.6.3-13.el7_9 will be an update
---> Package freetype.x86_64 0:2.8-14.el7 will be updated
---> Package freetype.x86_64 0:2.8-14.el7_9.1 will be an update
---> Package glib2.x86_64 0:2.56.1-7.el7 will be updated
---> Package glib2.x86_64 0:2.56.1-9.el7_9 will be an update
---> Package grub2.x86_64 1:2.02-0.86.el7.centos will be updated
---> Package grub2.x86_64 1:2.02-0.87.0.2.el7.centos.14 will be an update
---> Package grub2-common.noarch 1:2.02-0.86.el7.centos will be updated
---> Package grub2-common.noarch 1:2.02-0.87.0.2.el7.centos.14 will be an update
---> Package grub2-pc.x86_64 1:2.02-0.86.el7.centos will be updated
---> Package grub2-pc.x86_64 1:2.02-0.87.0.2.el7.centos.14 will be an update
---> Package grub2-pc-modules.noarch 1:2.02-0.86.el7.centos will be updated
---> Package grub2-pc-modules.noarch 1:2.02-0.87.0.2.el7.centos.14 will be an 
.....
pdated:
  NetworkManager.x86_64 1:1.18.8-2.el7_9                    NetworkManager-libnm.x86_64 1:1.18.8-2.el7_9          NetworkManager-team.x86_64 1:1.18.8-2.el7_9            
  NetworkManager-tui.x86_64 1:1.18.8-2.el7_9                bash.x86_64 0:4.2.46-35.el7_9                         bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.15       
  binutils.x86_64 0:2.27-44.base.el7_9.1                    ca-certificates.noarch 0:2023.2.60_v7.0.306-72.el7_9  centos-release.x86_64 0:7-9.2009.1.el7.centos          
  coreutils.x86_64 0:8.22-24.el7_9.2                        cronie.x86_64 0:1.4.11-25.el7_9                       cronie-anacron.x86_64 0:1.4.11-25.el7_9                
  cyrus-sasl-lib.x86_64 0:2.1.26-24.el7_9                   device-mapper.x86_64 7:1.02.170-6.el7_9.5             device-mapper-event.x86_64 7:1.02.170-6.el7_9.5        
  device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.5      device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5        device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2 
  dhclient.x86_64 12:4.2.5-83.el7.centos.1                  dhcp-common.x86_64 12:4.2.5-83.el7.centos.1           dhcp-libs.x86_64 12:4.2.5-83.el7.centos.1              
  diffutils.x86_64 0:3.3-6.el7_9                            dmidecode.x86_64 1:3.2-5.el7_9.1                      firewalld.noarch 0:0.6.3-13.el7_9                      
  firewalld-filesystem.noarch 0:0.6.3-13.el7_9              freetype.x86_64 0:2.8-14.el7_9.1                      glib2.x86_64 0:2.56.1-9.el7_9                          
  grub2.x86_64 1:2.02-0.87.0.2.el7.centos.14                grub2-common.noarch 1:2.02-0.87.0.2.el7.centos.14     grub2-pc.x86_64 1:2.02-0.87.0.2.el7.centos.14          
  grub2-pc-modules.noarch 1:2.02-0.87.0.2.el7.centos.14     grub2-tools.x86_64 1:2.02-0.87.0.2.el7.centos.14      grub2-tools-extra.x86_64 1:2.02-0.87.0.2.el7.centos.14 
  grub2-tools-minimal.x86_64 1:2.02-0.87.0.2.el7.centos.14  gzip.x86_64 0:1.5-11.el7_9                            initscripts.x86_64 0:9.49.53-1.el7_9.1                 
  iprutils.x86_64 0:2.4.17.1-3.el7_7                        iwl100-firmware.noarch 0:39.31.5.1-82.el7_9           iwl1000-firmware.noarch 1:39.31.5.1-82.el7_9           
  iwl105-firmware.noarch 0:18.168.6.1-82.el7_9              iwl135-firmware.noarch 0:18.168.6.1-82.el7_9          iwl2000-firmware.noarch 0:18.168.6.1-82.el7_9          
  iwl2030-firmware.noarch 0:18.168.6.1-82.el7_9             iwl3160-firmware.noarch 0:25.30.13.0-82.el7_9         iwl3945-firmware.noarch 0:15.32.2.9-82.el7_9           
  iwl4965-firmware.noarch 0:228.61.2.24-82.el7_9            iwl5000-firmware.noarch 0:8.83.5.1_1-82.el7_9         iwl5150-firmware.noarch 0:8.24.2.2-82.el7_9            
  iwl6000-firmware.noarch 0:9.221.4.1-82.el7_9              iwl6000g2a-firmware.noarch 0:18.168.6.1-82.el7_9      iwl6000g2b-firmware.noarch 0:18.168.6.1-82.el7_9       
  iwl6050-firmware.noarch 0:41.28.5.1-82.el7_9              iwl7260-firmware.noarch 0:25.30.13.0-82.el7_9         kbd.x86_64 0:1.15.5-16.el7_9                           
  kbd-legacy.noarch 0:1.15.5-16.el7_9                       kbd-misc.noarch 0:1.15.5-16.el7_9                     kernel-tools.x86_64 0:3.10.0-1160.118.1.el7            
  kernel-tools-libs.x86_64 0:3.10.0-1160.118.1.el7          kexec-tools.x86_64 0:2.0.15-51.el7_9.3                kpartx.x86_64 0:0.4.9-136.el7_9                        
  libblkid.x86_64 0:2.23.2-65.el7_9.1                       libcroco.x86_64 0:0.6.12-6.el7_9                      libmount.x86_64 0:2.23.2-65.el7_9.1                    
  libsmartcols.x86_64 0:2.23.2-65.el7_9.1                   libssh2.x86_64 0:1.8.0-4.el7_9.1                      libuuid.x86_64 0:2.23.2-65.el7_9.1                     
  libxml2.x86_64 0:2.9.1-6.el7_9.6                          linux-firmware.noarch 0:20200421-82.git78c0348.el7_9  lvm2.x86_64 7:2.02.187-6.el7_9.5                       
  lvm2-libs.x86_64 7:2.02.187-6.el7_9.5                     microcode_ctl.x86_64 2:2.1-73.20.el7_9                nspr.x86_64 0:4.35.0-1.el7_9                           
  nss.x86_64 0:3.90.0-2.el7_9                               nss-pem.x86_64 0:1.0.3-7.el7_9.1                      nss-softokn.x86_64 0:3.90.0-6.el7_9                    
  nss-softokn-freebl.x86_64 0:3.90.0-6.el7_9                nss-sysinit.x86_64 0:3.90.0-2.el7_9                   nss-tools.x86_64 0:3.90.0-2.el7_9                      
  nss-util.x86_64 0:3.90.0-1.el7_9                          openldap.x86_64 0:2.4.44-25.el7_9                     openssh.x86_64 0:7.4p1-23.el7_9                        
  openssh-clients.x86_64 0:7.4p1-23.el7_9                   openssh-server.x86_64 0:7.4p1-23.el7_9                polkit.x86_64 0:0.112-26.el7_9.1                       
  python.x86_64 0:2.7.5-94.el7_9                            python-firewall.noarch 0:0.6.3-13.el7_9               python-libs.x86_64 0:2.7.5-94.el7_9                    
  python-perf.x86_64 0:3.10.0-1160.118.1.el7                rpm.x86_64 0:4.11.3-48.el7_9                          rpm-build-libs.x86_64 0:4.11.3-48.el7_9                
  rpm-libs.x86_64 0:4.11.3-48.el7_9                         rpm-python.x86_64 0:4.11.3-48.el7_9                   rsyslog.x86_64 0:8.24.0-57.el7_9.3                     
  selinux-policy.noarch 0:3.13.1-268.el7_9.2                selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2   sudo.x86_64 0:1.8.23-10.el7_9.3                        
  systemd.x86_64 0:219-78.el7_9.9                           systemd-libs.x86_64 0:219-78.el7_9.9                  systemd-sysv.x86_64 0:219-78.el7_9.9                   
  tuned.noarch 0:2.11.0-12.el7_9                            tzdata.noarch 0:2024a-1.el7                           util-linux.x86_64 0:2.23.2-65.el7_9.1                  
  vim-minimal.x86_64 2:7.4.629-8.el7_9                      virt-what.x86_64 0:1.18-4.el7_9.1                     wpa_supplicant.x86_64 1:2.6-12.el7_9.2                 
  xz.x86_64 0:5.2.2-2.el7_9                                 xz-libs.x86_64 0:5.2.2-2.el7_9                       

Complete!
root@localhost ~]# sudo yum install boost-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package boost-devel.x86_64 0:1.53.0-28.el7 will be installed
--> Processing Dependency: boost(x86-64) = 1.53.0-28.el7 for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_wserialization.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_wserialization-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_wave.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_wave-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_unit_test_framework.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_unit_test_framework-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_timer.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_timer-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_system.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_system-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_signals.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_signals-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_serialization.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_serialization-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_regex.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_regex-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_random.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_random-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_python.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_python-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_program_options.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_program_options-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_prg_exec_monitor.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_prg_exec_monitor-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_math_tr1l.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_math_tr1l-mt.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
--> Processing Dependency: libboost_math_tr1f.so.1.53.0()(64bit) for package: boost-devel-1.53.0-28.el7.x86_64
 Verifying  : boost-test-1.53.0-28.el7.x86_64                                                                                                                      19/23 
  Verifying  : boost-math-1.53.0-28.el7.x86_64                                                                                                                      20/23 
  Verifying  : boost-chrono-1.53.0-28.el7.x86_64                                                                                                                    21/23 
  Verifying  : boost-1.53.0-28.el7.x86_64                                                                                                                           22/23 
  Verifying  : boost-filesystem-1.53.0-28.el7.x86_64                                                                                                                23/23 

Installed:
  boost-devel.x86_64 0:1.53.0-28.el7                                                                                                                                      

Dependency Installed:
  boost.x86_64 0:1.53.0-28.el7            boost-atomic.x86_64 0:1.53.0-28.el7      boost-chrono.x86_64 0:1.53.0-28.el7           boost-context.x86_64 0:1.53.0-28.el7   
  boost-date-time.x86_64 0:1.53.0-28.el7  boost-filesystem.x86_64 0:1.53.0-28.el7  boost-graph.x86_64 0:1.53.0-28.el7            boost-iostreams.x86_64 0:1.53.0-28.el7 
  boost-locale.x86_64 0:1.53.0-28.el7     boost-math.x86_64 0:1.53.0-28.el7        boost-program-options.x86_64 0:1.53.0-28.el7  boost-python.x86_64 0:1.53.0-28.el7    
  boost-random.x86_64 0:1.53.0-28.el7     boost-regex.x86_64 0:1.53.0-28.el7       boost-serialization.x86_64 0:1.53.0-28.el7    boost-signals.x86_64 0:1.53.0-28.el7   
  boost-system.x86_64 0:1.53.0-28.el7     boost-test.x86_64 0:1.53.0-28.el7        boost-thread.x86_64 0:1.53.0-28.el7           boost-timer.x86_64 0:1.53.0-28.el7     
  boost-wave.x86_64 0:1.53.0-28.el7       libicu.x86_64 0:50.2-4.el7_7            

Complete!
[root@localhost ~]# 
.....

通过YUM安装的Boost版本为1.53,目前官网的版本为1.85,接下来我们通过编译安装Boost1.85

卸载命令

yum remove boost-devel

效果如下:

[root@localhost ~]# yum remove boost-devel
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package boost-devel.x86_64 0:1.53.0-28.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================
 Package                                    Arch                                  Version                                      Repository                            Size
==========================================================================================================================================================================
Removing:
 boost-devel                                x86_64                                1.53.0-28.el7                                @base                                 85 M

Transaction Summary
==========================================================================================================================================================================
Remove  1 Package

Installed size: 85 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : boost-devel-1.53.0-28.el7.x86_64                                                                                                                       1/1 
  Verifying  : boost-devel-1.53.0-28.el7.x86_64                                                                                                                       1/1 

Removed:
  boost-devel.x86_64 0:1.53.0-28.el7                                                                                                                                      

Complete!
[root@localhost ~]# 

通过编译安装(官网最新版本1.85.0)

1.安装相关依赖

yum -y install gcc gcc-c++ python python-devel libicu libicu-devel zlib zlib-devel bzip2 bzip2-devel

效果如下:

[root@localhost ~]# yum -y install gcc gcc-c++ python python-devel libicu libicu-devel zlib zlib-devel bzip2 bzip2-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
Package gcc-4.8.5-44.el7.x86_64 already installed and latest version
Package gcc-c++-4.8.5-44.el7.x86_64 already installed and latest version
Package python-2.7.5-94.el7_9.x86_64 already installed and latest version
Package libicu-50.2-4.el7_7.x86_64 already installed and latest version
Package zlib-1.2.7-21.el7_9.x86_64 already installed and latest version
Package zlib-devel-1.2.7-21.el7_9.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
---> Package bzip2-devel.x86_64 0:1.0.6-13.el7 will be installed
---> Package libicu-devel.x86_64 0:50.2-4.el7_7 will be installed
---> Package python-devel.x86_64 0:2.7.5-94.el7_9 will be installed
--> Processing Dependency: python2-rpm-macros > 3-30 for package: python-devel-2.7.5-94.el7_9.x86_64
--> Processing Dependency: python-rpm-macros > 3-30 for package: python-devel-2.7.5-94.el7_9.x86_64
--> Running transaction check
---> Package python-rpm-macros.noarch 0:3-34.el7 will be installed
--> Processing Dependency: python-srpm-macros for package: python-rpm-macros-3-34.el7.noarch
---> Package python2-rpm-macros.noarch 0:3-34.el7 will be installed
--> Running transaction check
---> Package python-srpm-macros.noarch 0:3-34.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================
 Package                                        Arch                               Version                                      Repository                           Size
==========================================================================================================================================================================
Installing:
 bzip2                                          x86_64                             1.0.6-13.el7                                 base                                 52 k
 bzip2-devel                                    x86_64                             1.0.6-13.el7                                 base                                218 k
 libicu-devel                                   x86_64                             50.2-4.el7_7                                 base                                703 k
 python-devel                                   x86_64                             2.7.5-94.el7_9                               updates                             399 k
Installing for dependencies:
 python-rpm-macros                              noarch                             3-34.el7                                     base                                9.1 k
 python-srpm-macros                             noarch                             3-34.el7                                     base                                8.8 k
 python2-rpm-macros                             noarch                             3-34.el7                                     base                                8.1 k

Transaction Summary
==========================================================================================================================================================================
Install  4 Packages (+3 Dependent packages)

Total download size: 1.4 M
Installed size: 5.4 M
Downloading packages:
(1/7): bzip2-1.0.6-13.el7.x86_64.rpm                                                                                                               |  52 kB  00:00:00     
(2/7): python-srpm-macros-3-34.el7.noarch.rpm                                                                                                      | 8.8 kB  00:00:00     
(3/7): python-rpm-macros-3-34.el7.noarch.rpm                                                                                                       | 9.1 kB  00:00:00     
(4/7): python2-rpm-macros-3-34.el7.noarch.rpm                                                                                                      | 8.1 kB  00:00:00     
(5/7): bzip2-devel-1.0.6-13.el7.x86_64.rpm                                                                                                         | 218 kB  00:00:00     
(6/7): python-devel-2.7.5-94.el7_9.x86_64.rpm                                                                                                      | 399 kB  00:00:00     
(7/7): libicu-devel-50.2-4.el7_7.x86_64.rpm                                                                                                        | 703 kB  00:00:01     
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                     999 kB/s | 1.4 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-srpm-macros-3-34.el7.noarch                                                                                                                     1/7 
  Installing : python-rpm-macros-3-34.el7.noarch                                                                                                                      2/7 
  Installing : python2-rpm-macros-3-34.el7.noarch                                                                                                                     3/7 
  Installing : python-devel-2.7.5-94.el7_9.x86_64                                                                                                                     4/7 
  Installing : libicu-devel-50.2-4.el7_7.x86_64                                                                                                                       5/7 
  Installing : bzip2-1.0.6-13.el7.x86_64                                                                                                                              6/7 
  Installing : bzip2-devel-1.0.6-13.el7.x86_64                                                                                                                        7/7 
  Verifying  : bzip2-devel-1.0.6-13.el7.x86_64                                                                                                                        1/7 
  Verifying  : python2-rpm-macros-3-34.el7.noarch                                                                                                                     2/7 
  Verifying  : bzip2-1.0.6-13.el7.x86_64                                                                                                                              3/7 
  Verifying  : python-rpm-macros-3-34.el7.noarch                                                                                                                      4/7 
  Verifying  : libicu-devel-50.2-4.el7_7.x86_64                                                                                                                       5/7 
  Verifying  : python-srpm-macros-3-34.el7.noarch                                                                                                                     6/7 
  Verifying  : python-devel-2.7.5-94.el7_9.x86_64                                                                                                                     7/7 

Installed:
  bzip2.x86_64 0:1.0.6-13.el7         bzip2-devel.x86_64 0:1.0.6-13.el7         libicu-devel.x86_64 0:50.2-4.el7_7         python-devel.x86_64 0:2.7.5-94.el7_9        

Dependency Installed:
  python-rpm-macros.noarch 0:3-34.el7                    python-srpm-macros.noarch 0:3-34.el7                    python2-rpm-macros.noarch 0:3-34.el7                   

Complete!
[root@localhost ~]# 

2.查询官网下载最新安装包并解压

boost官网地址:https://www.boost.org/
在这里插入图片描述
执行命令如下

cd /usr/local
wget https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.gz
tar -xzvf boost_1_85_0.tar.gz
cd boost_1_85_0

3.编译Boost

./bootstrap.sh
./b2

效果如下:

[root@localhost boost_1_85_0]# ./bootstrap.sh
Building B2 engine..

###
###
### Using 'gcc' toolset.
###
###

g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 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 -pthread -O2 -s -DNDEBUG bindjam.cpp builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.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 option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp tasks.cpp timestamp.cpp value.cpp variable.cpp w32_getreg.cpp mod_jam_builtin.cpp mod_jam_class.cpp mod_jam_errors.cpp mod_jam_modules.cpp mod_order.cpp mod_path.cpp mod_property_set.cpp mod_regex.cpp mod_sequence.cpp mod_set.cpp mod_string.cpp mod_summary.cpp mod_sysinfo.cpp mod_version.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:

    ./b2
    
To generate header files, run:

    ./b2 headers

The 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/

[root@localhost boost_1_85_0]# ./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]
    - cxx11_static_assert      : no [2]
    - compiler supports SSE2   : yes [3]
    - compiler supports SSE4.1 : yes [3]
    - cxx11_static_assert      : no [3]
    - cxx11_variadic_templates : no [2]
    - cxx11_variadic_templates : no [3]
    - cxx11_hdr_ratio          : no [2]
    - cxx11_hdr_ratio          : no [3]
    - cxx20_hdr_concepts       : no [2]
    - cxx20_hdr_concepts       : no [3]
    - has std::atomic_ref      : no [2]
    - has -Wl,--no-undefined   : yes [2]
    - has statx                : no [2]
    - has statx syscall        : no [2]
    - cxx11_rvalue_references  : no [2]
    - has std::atomic_ref      : no [3]
    - has -Wl,--no-undefined   : yes [3]
    - has statx                : no [3]
    - has statx syscall        : no [3]
    - cxx11_rvalue_references  : no [3]
    - cxx11_auto_declarations  : no [2]
    - cxx11_auto_declarations  : no [3]
    - 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]
    - has fallocate            : yes [2]
    - 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]
    - icu                      : yes [2]
    - iconv (libc)             : yes [2]
    - icu                      : yes [3]
    - iconv (libc)             : yes [3]
    - native atomic int32 supported : no [2]
    - native syslog supported  : yes [2]
    - pthread supports robust mutexes : yes [2]
    - Boost.Regex is header-only : no [2]
    - lockfree boost::atomic_flag : no [2]
    - compiler supports SSSE3  : yes [2]
    - compiler supports AVX2   : yes [2]
    - compiler supports SSSE3  : yes [3]
    - compiler supports AVX2   : yes [3]
    - native atomic int32 supported : no [3]
    - native syslog supported  : yes [3]
    - pthread supports robust mutexes : yes [3]
    - cxx11_lambdas            : no [2]
    - cxx11_lambdas            : no [3]
    - gcc visibility           : yes [2]
    - cxx11_noexcept           : no [2]
    - gcc visibility           : yes [3]
    - cxx11_noexcept           : no [3]
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
    - std_wstreambuf builds    : yes [2]
    - std_wstreambuf           : yes [2]
    - BOOST_COMP_GNUC >= 4.3.0 : no [2]
    - BOOST_COMP_GNUC >= 4.3.0 : no [4]
    - compiler supports SSE2   : yes [4]
    - compiler supports SSE4.1 : yes [4]
    - cxx11_static_assert      : no [4]
    - compiler supports SSE2   : yes [5]
    - compiler supports SSE4.1 : yes [5]
    - cxx11_static_assert      : no [5]
    - cxx11_variadic_templates : no [4]
    - cxx11_variadic_templates : no [5]
    - cxx11_hdr_ratio          : no [4]
    - cxx11_hdr_ratio          : no [5]
    - cxx20_hdr_concepts       : no [4]
    - cxx20_hdr_concepts       : no [5]
    - has std::atomic_ref      : no [4]
    - has statx                : no [4]
    - has statx syscall        : no [4]
    - cxx11_rvalue_references  : no [4]
    - has std::atomic_ref      : no [5]
    - has statx                : no [5]
    - has statx syscall        : no [5]
    - cxx11_rvalue_references  : no [5]
    - cxx11_auto_declarations  : no [4]
    - cxx11_auto_declarations  : no [5]
    - has init_priority attribute : yes [4]
    - has stat::st_blksize     : yes [4]
    - has stat::st_mtim        : yes [4]
    - has stat::st_mtimensec   : no [4]
    - has stat::st_mtimespec   : no [4]
    - has stat::st_birthtim    : no [4]
    - has stat::st_birthtimensec : no [4]
    - has stat::st_birthtimespec : no [4]
    - has fdopendir(O_NOFOLLOW) : yes [4]
    - has dirent::d_type       : yes [4]
    - has POSIX *at APIs       : yes [4]
    - has fallocate            : yes [4]
    - has_icu builds           : yes [4]
....
gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/link-static/threading-multi/visibility-hidden/xml_report_formatter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/compiler_log_formatter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/cpp_main.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/debug.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/decorator.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/execution_monitor.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/framework.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/junit_log_formatter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/plain_report_formatter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/progress_monitor.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/results_collector.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/results_reporter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/test_tools.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/test_tree.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_log.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_main.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_monitor.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_parameters.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/xml_log_formatter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/xml_report_formatter.o
[root@localhost boost_1_85_0]# 

这将编译并安装Boost库到默认的系统路径,如/usr/local/include和/usr/local/lib。如果你需要特定的编译选项或者库的子集,你可以在运行./bootstrap.sh时添加参数,例如,只编译线程库和系统库:

./bootstrap.sh --with-libraries=system,thread
./b2

4.安装Boost库到系统路径

sudo ./b2 install

效果如下:

    - default address-model    : 64-bit (cached) [1]
    - default architecture     : x86 (cached) [1]
    - compiler supports SSE2   : yes (cached) [2]
    - compiler supports SSE4.1 : yes (cached) [2]
    - cxx11_static_assert      : no  (cached) [2]
    - compiler supports SSE2   : yes (cached) [3]
    - compiler supports SSE4.1 : yes (cached) [3]
    - cxx11_static_assert      : no  (cached) [3]
    - cxx11_variadic_templates : no  (cached) [2]
    - cxx11_variadic_templates : no  (cached) [3]
    - cxx11_hdr_ratio          : no  (cached) [2]
    - cxx11_hdr_ratio          : no  (cached) [3]
    - cxx20_hdr_concepts       : no  (cached) [2]
    - cxx20_hdr_concepts       : no  (cached) [3]
    - has std::atomic_ref      : no  (cached) [2]
    - has -Wl,--no-undefined   : yes (cached) [2]
    - has statx                : no  (cached) [2]
    - has statx syscall        : no  (cached) [2]
    - cxx11_rvalue_references  : no  (cached) [2]
    - has std::atomic_ref      : no  (cached) [3]
    - has -Wl,--no-undefined   : yes (cached) [3]
    - has statx                : no  (cached) [3]
    - has statx syscall        : no  (cached) [3]
    - cxx11_rvalue_references  : no  (cached) [3]
    - cxx11_auto_declarations  : no  (cached) [2]
    - cxx11_auto_declarations  : no  (cached) [3]
    - has init_priority attribute : yes (cached) [2]
    - has stat::st_blksize     : yes (cached) [2]
    - has stat::st_mtim        : yes (cached) [2]
    - has stat::st_mtimensec   : no  (cached) [2]
    - has stat::st_mtimespec   : no  (cached) [2]
    - has stat::st_birthtim    : no  (cached) [2]
    - has stat::st_birthtimensec : no  (cached) [2]
    - has stat::st_birthtimespec : no  (cached) [2]
    - has fdopendir(O_NOFOLLOW) : yes (cached) [2]
    - has dirent::d_type       : yes (cached) [2]
    - has POSIX *at APIs       : yes (cached) [2]
    - has fallocate            : yes (cached) [2]
    - has_icu builds           : yes (cached) [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 (cached)
    - bzip2                    : yes (cached)
    - lzma                     : no  (cached)
    - zstd                     : no  (cached)
    - has_lzma_cputhreads builds : no  (cached) [2]
    - cxx11_constexpr          : no  (cached) [2]
    - cxx11_constexpr          : no  (cached) [3]
    - icu                      : yes (cached) [2]
    - iconv (libc)             : yes (cached) [2]
    - icu                      : yes (cached) [3]
    - iconv (libc)             : yes (cached) [3]
    - native atomic int32 supported : no  (cached) [2]
    - native syslog supported  : yes (cached) [2]
    - pthread supports robust mutexes : yes (cached) [2]
    - Boost.Regex is header-only : no  (cached) [2]
    - lockfree boost::atomic_flag : no  (cached) [2]
    - compiler supports SSSE3  : yes (cached) [2]
    - compiler supports AVX2   : yes (cached) [2]
    - compiler supports SSSE3  : yes (cached) [3]
    - compiler supports AVX2   : yes (cached) [3]
    - native atomic int32 supported : no  (cached) [3]
    - native syslog supported  : yes (cached) [3]
    - pthread supports robust mutexes : yes (cached) [3]
    - cxx11_lambdas            : no  (cached) [2]
    - cxx11_lambdas            : no  (cached) [3]
    - gcc visibility           : yes (cached) [2]
    - cxx11_noexcept           : no  (cached) [2]
    - gcc visibility           : yes (cached) [3]
    - cxx11_noexcept           : no  (cached) [3]
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
    - std_wstreambuf builds    : yes (cached) [2]
....
 gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/plain_report_formatter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/progress_monitor.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/results_collector.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/results_reporter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/test_tools.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/test_tree.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_log.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_main.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_monitor.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/unit_test_parameters.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/xml_log_formatter.o
   gcc.compile.c++ bin.v2/libs/test/build/gcc-4.8/release/threading-multi/visibility-hidden/xml_report_formatter.o
[root@localhost boost_1_85_0]# 

Boost库验证

示例代码:

#include <boost/filesystem.hpp>
#include <iostream>

int main(int argc, char* argv[])
{
    if (argc < 2){
        std::cout << "Usage: " << argv[0] << " path\n";
        return 1;
    }

    boost::filesystem::path p(argv[1]);

    if (boost::filesystem::exists(p)) {
        if (boost::filesystem::is_directory(p))
            std::cout << p << " is a directory.\n";
        else if (boost::filesystem::is_regular_file(p))
            std::cout << p << " is a regular file.\n";
        else
            std::cout << p << " exists but is not a directory or regular file.\n";
    } else {
        std::cout << p << " does not exist.\n";
    }

    return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.28)
project(boost_example)
set(BOOST_ROOT "/usr/include")
set(Boost_INCLUDE_DIR "/usr/include")
set(Boost_SYSTEM_LIBRARY "/usr/include/boost/stage/lib")

set(CMAKE_CXX_STANDARD 20)
set(boostlib filesystem program_options regex)
#
find_package(Boost REQUIRED COMPONENTS ${boostlib})

add_executable(boost_example main.cpp)
if(Boost_FOUND)
    message(STATUS "Boost version found")
    message(STATUS " Boost libraries:${Boost_LIBRARIES}")
    target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
else()
    message(STATUS "Boost version not found")
endif()

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/609001.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

通义千问2.5正式发布,能力升级,全面赶超GPT4

简介 在人工智能的大潮中&#xff0c;大模型的竞争愈发激烈。今日&#xff0c;阿里云发布了其最新的通义千问2.5大模型&#xff0c;引起了业界的广泛关注。这款模型不仅在性能上全面赶超了GPT-4&#xff0c;还在多个基准测评中取得了优异的成绩&#xff0c;展现了国产AI技术的…

如何把公章盖在电子档文件上?

将公章盖在电子档文件上&#xff0c;尤其是确保其法律效力和安全性&#xff0c;通常涉及以下步骤&#xff1a; 准备工作 获取合法的电子公章&#xff1a;确保你拥有公司或机构正式授权的电子公章图像&#xff0c;且该图像经过了必要的加密或数字签名处理&#xff0c;以确保其…

LPDDR5电路设计的新功能

最近因为需要使用到LPDDR5&#xff0c;快速地浏览了JEDEC标准文档&#xff0c;发现与前几代相比出现了一些新的电路设计功能&#xff0c;总结为如下三点&#xff1a; 1. CK/WCK/RDQS时钟方案&#xff1b; 2. 电源的PDN设计目标&#xff1b; 3. DQ, DMI和RDQS的Rx端DFE均衡技术。…

五一超级课堂---Llama3-Tutorial(Llama 3 超级课堂)---第一节 Llama 3 本地 Web Demo 部署

课程文档&#xff1a; https://github.com/SmartFlowAI/Llama3-Tutorial 课程视频&#xff1a; https://space.bilibili.com/3546636263360696/channel/collectiondetail?sid2892740&spm_id_from333.788.0.0 操作平台&#xff1a; https://studio.intern-ai.org.cn/consol…

大模型入门(六)—— RLHF微调大模型

一、RLHF微调三阶段 参考&#xff1a;https://huggingface.co/blog/rlhf 1&#xff09;使用监督数据微调语言模型&#xff0c;和fine-tuning一致。 2&#xff09;训练奖励模型 奖励模型是输入一个文本序列&#xff0c;模型给出符合人类偏好的奖励数值&#xff0c;这个奖励数值…

亚马逊云科技中国峰会:与你开启云计算与前沿技术的探索之旅

亚马逊云科技中国峰会&#xff1a;与你开启云计算与前沿技术的探索之旅 Hello,我是科技博主Maynor&#xff0c;非常高兴地向你们推荐亚马逊云科技中国峰会&#xff0c;这是一场将于 5 月 29 日至 30 日在上海世博中心举办的科技盛会&#xff0c;如果你对云计算、行业发展新趋势…

IDEA 使用maven编译,控制台出现乱码问题的解决方式

前言 使用idea进行maven项目的编译时&#xff0c;控制台输出中文的时候出现乱码的情况。 通常出现这样的问题&#xff0c;都是因为编码格式不一样导致的。既然是maven出的问题&#xff0c;我们在idea中查找下看可以如何设置文件编码。 第一种方式 在pom.xml文件中&#xff…

Meta FAIR: 深层网络不合理的低效性

这篇文章的标题"The Unreasonable Ineffectiveness of the Deeper Layers"巧妙地呼应了著名物理学家尤金维格纳在1960年发表的一篇论文"数学在自然科学中不合理的有效性"(The Unreasonable Effectiveness of Mathematics in the Natural Sciences)。维格纳…

FPGA+炬力ARM实现VR视频播放器方案

FPGA炬力ARM方案&#xff0c;单个视频源信号&#xff0c;同时驱动两个LCD屏显示&#xff0c;实现3D 沉浸式播放 客户应用&#xff1a;VR视频播放器 主要功能&#xff1a; 1.支持多种格式视频文件播放 2.支持2D/3D 效果实时切换播放 3.支持TF卡/U盘文件播放 4.支持定制化配置…

Linux运维:centos环境变量

前言 在 Linux 运维工作中&#xff0c;管理环境变量是至关重要的一项任务。在 CentOS 环境下&#xff0c;正确配置环境变量可以使系统更加高效和易于管理。 本文将重点讨论 CentOS 环境下的环境变量设置&#xff0c;并就python的环境变量配置方案进行讲解&#xff08;不包含Ano…

AutoModelForCausalLM.from_pretrained 函数调用本地权重报错

文章目录 1、代码报错的位置&#xff08;前情提要&#xff09;finetune_lora.shfintune_clm_lora.py 2、报错截图2.1、huggingfaces上的 meta-llama/Llama-2-7b-chat-hf2.2、服务器上模型文件路径 3、特别注意事项 1、代码报错的位置&#xff08;前情提要&#xff09; 在终端直…

06.命令的组合使用

命令的组合使用 1.查询当前整个系统每个进程的线程数 我们经常遇到这样的问题&#xff0c;比如某台服务器的CPU 使用率飙升&#xff0c;通过top命令查看是某个程序&#xff08;例如java&#xff09;占用的cpu比较大&#xff0c;现在需要查询java各个进程下的线程数情况。可以通…

Reactor Netty HTTP 服务器端-响应式编程-014

🤗 ApiHug {Postman|Swagger|Api...} = 快↑ 准√ 省↓ GitHub - apihug/apihug.com: All abou the Apihug apihug.com: 有爱,有温度,有质量,有信任ApiHug - API design Copilot - IntelliJ IDEs Plugin | Marketplace The Next Generation API Development Platform …

风扇开启执行逻辑

执行流程 public static void businessExecutionWork(){//以下为业务逻辑部分System.out.println("1、根据电池包控制风扇服务执行 开始!");//1、获取电池包电压、电流、环境温度//获取电池包电压、电流、环境温度ObtainBatteryDataService obtainBatteryDataServic…

Docker 怎么将映射出的路径设置为非root用户权限

在Docker中&#xff0c;容器的根文件系统默认是由root用户拥有的。如果想要在映射到宿主机的路径时设置为非root用户权限&#xff0c;可以通过以下几种方式来实现&#xff1a; 1. 使用具有特定UID和GID的非root用户运行容器&#xff1a; 在运行容器时&#xff0c;你可以使用-u…

监控异地组网怎么组网?

监控异地组网是指在不同地域的网络环境下&#xff0c;实现对监控设备的远程访问和管理。在传统的网络环境下&#xff0c;由于网络限制和设备配置等问题&#xff0c;监控设备的远程访问往往受到一定的限制和困扰。为了解决这个问题&#xff0c;引入了天联组网技术&#xff0c;实…

Mysql幻读

幻读指的是一个事务在前后两次查询同一个范围的时候&#xff0c;后一次查询看到了前一次查询没有看到的行。 幻读仅专指“新插入的行” 在可重复读隔离级别下&#xff0c;普通的查询是快照读&#xff0c;是不会看到别的事务插入的数据的。因此&#xff0c;幻读在“当前读”下…

【JavaEE网络】HTTP/HTTPS协议的工作原理与格式详解

目录 HTTP/HTTPSHTTP是什么理解“应用层协议”理解HTTP协议的工作过程HTTP协议格式 HTTP/HTTPS HTTP是什么 应用层&#xff0c;一方面是需要自定义协议&#xff0c;一方面也会用到一些现成的协议 HTTP及HTTPS是应用层重点协议 使用浏览器&#xff0c;打开网站&#xff0c;这…

自动化运维工具——Ansible

一、Ansible的概念&#xff1a; 1.Ansible的介绍&#xff1a; Ansible是一个基于Python开发的配置管理和应用部署工具&#xff0c;现在也在自动化管理领域大放异彩。它融合了众多老牌运维工具的优点&#xff0c;Pubbet和Saltstack能实现的功能&#xff0c;Ansible基本上都可以…

OpenHarmony 实战开发(南向)-Docker编译环境搭建

Docker环境介绍 OpenHarmony为开发者提供了两种Docker环境&#xff0c;以帮助开发者快速完成复杂的开发环境准备工作。两种Docker环境及适用场景如下&#xff1a; 独立Docker环境&#xff1a;适用于直接基于Ubuntu、Windows操作系统平台进行版本编译的场景。 基于HPM的Docker…