日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

centos7安装boost记录

發布時間:2023/12/20 编程问答 59 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7安装boost记录 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

centos7騰訊服務器安裝記

首先打開官網中的下載網頁
downloads頁面
找到你需要的安裝包,我這里選擇的是boost_1_78_0.tar.gz的鏈接,右鍵打開就可以看到有個復制鏈接的選項。然后在我的服務器中輸入獲取壓縮包命令

wget https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz

下載好了以后,你可以在當前目錄看到boost_1_78_0.tar.gz的壓縮包,解壓后,進行編譯安裝吧。
進入安裝目錄,輸入以下命令:

./bootstrap.sh; ./b2 --buildtype=complete install

得到以下結果

Building B2 engine..Could not find a suitable toolset.You can specify the toolset as the argument, i.e.:./build.sh [options] gccToolsets supported by this script are:acc, clang, como, gcc, intel-darwin, intel-linux, kcc, kylix, mipspro,pathscale, pgi, qcc, sun, sunpro, tru64cxx, vacppFor any toolset you can override the path to the compiler with the '--cxx' option. You can also use additional flags for the compiler with the '--cxxflags' option.A special toolset; cxx, is available which is used as a fallback when a more specific toolset is not found and the cxx command is detected. The 'cxx' toolset will use the '--cxx' and '--cxxflags' options, if present.Options:--help Show this help message.--verbose Show messages about what this script is doing.--debug Build b2 with debug information, and nooptimizations.--guess-toolset Print the toolset we can detect for building.--cxx=CXX The compiler exec to use instead of the detectedcompiler exec.--cxxflags=CXXFLAGS The compiler flags to use in addition to theflags for the detected compiler.Failed to build B2 build engine

百度得到的結果是當前的gcc版本不對,然后檢查一下,當前版本為4.8.5,的確不對應,一般應該是gcc7版本,然后切換一下gcc版本,使用centos的scl來進行切換

yum install centos-release-scl yum install scl-utils yum install devtoolset-7-toolchain#安裝gcc7版本

安裝好了以后查看一下

[root@VM-0-17-centos boost_1_78_0]# scl --list devtoolset-7 [root@VM-0-17-centos boost_1_78_0]# scl enable devtoolset-7 bash [root@VM-0-17-centos boost_1_78_0]# gcc -v gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)

的確切換到了gcc7版本,重新跑一下看看

[root@VM-0-17-centos boost_1_78_0]# ./bootstrap.sh Building B2 engine..### ### ### Using 'cxx' toolset. ### ###cpp (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) Copyright (C) 2017 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.### ###> cpp -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 cpp: fatal error: too many input files compilation terminated. > cp b2 bjam cp: cannot stat ‘b2’: No such file or directoryFailed to build B2 build engine

嗯,不出所料,還是失敗,沒有編譯成功b2解釋器,最后還是沒能解決問題,準備在win11的WSL2中試驗centos7安裝boost來比對一下。

win11的centos7子系統安裝

之前在開啟WSL2服務的時候就在電腦里面搜索過centos系統,結果商店不支持,都是付費的,所以只能通過LxRunOffline來運行魔改版的centos了。

首先,LxRunOffline是一個WSL的第三方工具,是我國大牛開發的用來彌補WSL的不足的,主要可以實現任何Linux發行版的WSL形式,是個強大的管理工具,但使用起來卻很簡單,我們用得上的也就兩個文件:LxRunOffline.exe和LxRunOfflineShellExt.dll

進入github中的下載鏈接(可能很多新學者不習慣逛github,但這個強大的代碼托管平臺真的很適合你來熟悉),進去之后直接下載壓縮包即可,我選擇的是LxRunOffline-v3.5.0-msvc.zip,3.5版本的。

下載好了以后解壓縮,然后得到這兩個文件:LxRunOfflineShellExt.dll和LxRunOffline.exe,將他們放置到C:\Windows\System32下,然后在這個文件夾下用管理員身份打開cmd終端輸入以下命令完成功能注冊。

regsvr32 LxRunOfflineShellExt.dll

現在到這里,LxRunOffline就安裝好了,現在我們還需要centos7的魔改版鏡像,也很容易找到,就在LxRunOffline的gitbub項目下的centos分支中
centos7.8鏡像
(點擊界面中的download來下載鏡像,大家應該都知道的)

下載好以后需要存放在一個全英文路徑下(看教程這么說的,但我也沒試過放中文路徑咋樣,類似的情況倒是在其他軟件安裝使用時試過),然后使用LxRunOffline的install命令,如下:

PS E:\document> LxRunOffline install -n CentOS -f E:\document\centos-7.8.2003-x86_64-docker.tar.xz -d E:\linux\centos7.8 [WARNING] Love this tool? Would you like to make a donation: https://github.com/DDoSolitary/LxRunOffline/blob/master/README.md#donation

上面-f參數就是表明我的centos7.8鏡像位置,-d就是我的centos7的wsl形式安裝路徑,install完畢以后在這個路徑下就能看到安裝好的目錄列表,畢竟‘linux一切皆文件’(鳥哥說的)。

然后我們可以用LxRunOffline檢查一下當前安裝過的linux版本,Ubuntu和Debian都是我通過電腦的軟件商店安裝的,然后Centos是新加的,可以看到在這里有顯示了,另外還需要新增一個桌面快捷方式,后面的命令就是做這個作業的。

PS E:\document> LxRunOffline l Ubuntu Debian CentOS PS E:\document> LxRunOffline s -n CentOS -f C:\Users\samu\Desktop\CentOS7.8.lnk

也可以通過wsl -d centos的命令在cmd終端進行系統切換,效果如下:

PS C:\Users\samu\Desktop> wsl -d centos [root@DESKTOP-SJO8SMG Desktop]# cat /etc/centos-release CentOS Linux release 7.8.2003 (Core)

可通過exit方式退出centos,而桌面快捷方式打開是這樣的

要注意的是,這個時候的centos系統應該是按照最小安裝進行的,所以很多命令你在使用的時候會出現-bash: command not found的情況。不過幸好它配置了yum安裝工具,你可以很方便的安裝你需要的命令。

–更新一下:除了上面的方式來打開Centos,在上面的都搞定關機重啟后使用windows terminal后,應該能夠在下面的位置看到centos子系統,這樣就能直接打開了。(我的win11是這樣的,其他的不知道,如果有不同的情況請指明,我再更改以免誤導大家)

LxRunOffline的centos7安裝boost記

當前所處的centos7有很多命令都需要另外安裝,包括獲取安裝包的wget命令,所以我們先安裝下需要的工具吧。

yum -y install wget yum -y install sudo sudo yum install gcc

上面安裝的是gcc4版本,所以上面在centos服務器上進行過的scl操作也要進行一次。

yum install centos-release-scl yum install scl-utils yum install devtoolset-7-toolchain#安裝gcc7版本 scl enable devtoolset-7 bash

然后就獲取壓縮包,解壓壓縮包,巴拉巴拉。

wget https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz tar xvzf boost_1_78_0.tar.gz

切換到boost_1_78_0.tar.gz的根目錄下,運行bootstrap.sh腳本生成boost的build程序b2

./bootstrap.sh

不過我這個好像還是有點問題,生成過程中出現Unicode/ICU support for Boost.Regex?.. not found.這樣一個情況,不過b2好像是生成在本目錄下了,運行一下。

./b2 --buildtype=complete install

因為我想要比較全面地boost庫,所以使用了全部安裝,具體其他參數大家可以百度一下,應該很簡單就能找到了。說明一下,我這里的安裝都是生成在/usr/local目錄下了,部分實現文件在lib目錄下,其他大多以.hpp(.h+.cpp,聲明+實現)的形式存放在include目錄下。
測試如下

#include <iostream> #include <boost/version.hpp> #include <boost/config.hpp> using namespace std; int main() { cout << BOOST_VERSION << endl; cout << BOOST_LIB_VERSION << endl; cout << BOOST_PLATFORM << endl; cout << BOOST_COMPILER << endl; cout << BOOST_STDLIB << endl; return 0; }

尋常編譯,結果如下:

[root@DESKTOP-SJO8SMG project]# g++ version.cpp -o version [root@DESKTOP-SJO8SMG project]# ./version 107800 1_78 linux GNU C++ version 7.3.1 20180303 (Red Hat 7.3.1-5) GNU libstdc++ version 20180303

由于上面的編譯生成是有缺陷的,它跳過了10個生成項目,至于是哪幾個,目前就看到一個boost.regex好像有點問題,因為沒用到,不確定是不是,只是build記錄這門顯示,項目實在太多,后面遇到再更新吧。

總結

以上是生活随笔為你收集整理的centos7安装boost记录的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。