Centos7 installation boost record

centos7 Tencent server installation notes


First, open the downloads page on the official website
and find the installation package you need. I chose the boost_1_78_0.tar.gz link here. Right-click to open it and you will see an option to copy the link. Then enter the command to get the compressed package in my server

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

After downloading, you can see the boost_1_78_0.tar.gz compressed package in the current directory. After decompressing it, compile and install it.
Enter the installation directory and enter the following command:

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

Got the following result

Building B2 engine..

Could not find a suitable toolset.

You can specify the toolset as the argument, i.e.:
    ./build.sh [options] gcc

Toolsets supported by this script are:
    acc, clang, como, gcc, intel-darwin, intel-linux, kcc, kylix, mipspro,
    pathscale, pgi, qcc, sun, sunpro, tru64cxx, vacpp

For 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 no
                            optimizations.
    --guess-toolset         Print the toolset we can detect for building.
    --cxx=CXX               The compiler exec to use instead of the detected
                            compiler exec.
    --cxxflags=CXXFLAGS     The compiler flags to use in addition to the
                            flags for the detected compiler.



Failed to build B2 build engine

The result obtained by Baidu is that the current gcc version is wrong. Then check it. The current version is 4.8.5, which does not correspond. Generally it should be the gcc7 version. Then switch the gcc version and use centos scl to switch.

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

Check it out after installing it

[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)

I did switch to the gcc7 version, run it again and see

[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 directory

Failed to build B2 build engine

Well, as expected, it still failed. The b2 interpreter was not compiled successfully. In the end, the problem was still not solved. I am going to try centos7 to install boost in WSL2 of win11 for comparison.

Centos7 subsystem installation of win11

When I turned on the WSL2 service, I searched for the centos system on my computer. The result was that the store did not support it and it was all paid, so I could only run the modified version of centos through LxRunOffline.

First of all, LxRunOffline is a third-party tool for WSL. It was developed by Chinese experts to make up for the shortcomings of WSL. It can mainly implement the WSL form of any Linux distribution. It is a powerful management tool, but it is very simple to use. We There are only two files that can be used: LxRunOffline.exe and LxRunOfflineShellExt.dll

Enter the download link in github (many new scholars may not be used to visiting github, but this powerful code hosting platform is really suitable for you to get familiar with). After entering, you can download the compressed package directly. I chose LxRunOffline-v3.5.0 -msvc.zip, version 3.5.
Insert image description here
After downloading, unzip it and get these two files: LxRunOfflineShellExt.dll and LxRunOffline.exe. Place them in C:\Windows\System32, then open the cmd terminal as an administrator in this folder and enter the following command Complete function registration.

regsvr32 LxRunOfflineShellExt.dll

Now here, LxRunOffline is installed. Now we also need the modified version of centos7 image, which is also easy to find. It is in the centos branch under the gitbub project of LxRunOffline. The
centos7.8 image
(click download in the interface to download the image, Everyone should know)
Insert image description here

After downloading, it needs to be stored in an all-English path (the tutorial says so, but I have never tried putting a Chinese path. I have tried similar situations when installing and using other software), and then use the install command of LxRunOffline ,as follows:

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

The -f parameter above indicates the location of my centos7.8 image, and -d is the wsl installation path of my centos7. After the installation is completed, you can see the installed directory list under this path. After all, 'everything in Linux is a file' (Brother Bird said).
Insert image description here
Then we can use LxRunOffline to check the currently installed Linux version. Ubuntu and Debian were both installed by me through the computer’s software store, and Centos is newly added. You can see that it is displayed here. In addition, you need to add a new one. Desktop shortcut, the following commands do this job.

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

You can also use the wsl -d centos command to switch systems in the cmd terminal. The effect is as follows:

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

Centos can be exited through the exit method, and the desktop shortcut is opened like this
Insert image description here
. It should be noted that the centos system at this time should be carried out according to the minimum installation, so when you use many commands, -bash: command not found will appear. Condition. Fortunately, it is equipped with the yum installation tool, so you can easily install the commands you need.

–Update: In addition to the above method to open Centos, after shutting down and restarting and using windows terminal, you should be able to see the centos subsystem in the following location, so that you can open it directly. (My win11 is like this, I don’t know about others. If there is a different situation, please indicate it and I will change it to avoid misleading everyone)
Insert image description here

LxRunOffline centos7 installation boost notes

The centos7 we are currently in has many commands that need to be installed separately, including the wget command to obtain the installation package, so let’s install the required tools first.

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

The gcc4 version is installed above, so the scl operation performed on the centos server above must also be performed.

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

Then get the compressed package, decompress the compressed package, blah blah blah.

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

Switch to the root directory of boost_1_78_0.tar.gz and run the bootstrap.sh script to generate the boost build program b2

./bootstrap.sh

However, I still seem to have some problems. Unicode/ICU support for Boost.Regex?.. not found. appears during the generation process. However, b2 seems to be generated in this directory. Run it.

./b2 --buildtype=complete install

Because I wanted a more comprehensive boost library, I used all the installations. You can search Baidu for other specific parameters and it should be easy to find. To explain, my installation here is all generated in the /usr/local directory, some implementation files are in the lib directory, and most of the others are stored in the include directory in the form of .hpp (.h+.cpp, declaration + implementation).
The test is as follows

#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;
}

Compiled normally, the results are as follows:

[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 

Since the above compilation and generation is defective, it skipped 10 generated projects. As for which ones, there seems to be something wrong with a boost.regex because it is not used. I am not sure if it is, it is just a build record. This door shows that there are too many projects. I will update them when I encounter them later.

Guess you like

Origin blog.csdn.net/weixin_44948269/article/details/121856832