Requirement: Visual stuio 2019 LLVM : http://releases.llvm.org/8.0.0/LLVM-8.0.0-win64.exe
Step 1: Install Visual studio 2019
Step 2: Install LLVM (remember to check add llvm to system enviroment path)
Step 3: Check if clang is work: Open cmd, type:
clang --version
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\LLVM\bin
Step 4: Download boost library source code: https://dl.bintray.com/boostorg/release/1.70.0/source/
step 4:
cd C:\boost_source_dir
step 5: Edit project-config.jam file in boost source dir
# Boost.Build Configuration
# Automatically generated by bootstrap.bat
import option ;
using clang
:
:
:
cxxstd=17
<ranlib>"C:/LLVM/bin/llvm-ranlib.exe"
<archiver>"C:/LLVM/bin/llvm-ar.exe"
<cxxflags>-D_CRT_SECURE_NO_WARNINGS
<cxxflags>-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
;
option.set keep-going : false ;
step 6: Compile boost
bootstrap
b2 cxxstd=17 link=static address-model=64 --layout=tagged --build-type=complete --architecture=x64 --threading=multi toolset=clang --without-python --withtout-icu variant=release
It's will give a lot of warning for deprecated functions, but it works.
我尝试用--with-python这个参数编译
使用的clang情况为:
clang version 11.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
.jam文件中内容:
Boost.Build Configuration
Automatically generated by bootstrap.bat
import option ;
using clang
:
:
:
cxxstd=17
"C:/LLVM/bin/llvm-ranlib.exe"
"C:/LLVM/bin/llvm-ar.exe"
-D_CRT_SECURE_NO_WARNINGS
-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
;
option.set keep-going : false ;
using python : 3.8 : (home)\Miniconda3\envs\py38 : (home)\Miniconda3\envs\py38\include : (home)\Miniconda3\envs\py38\libs ;
执行b2的指令为:
b2 install link=static runtime-link=shared --with-python
最终未能生成库文件