7

I search a lot, but I didn't find any useful step by step guide to install and configure and build boost in Windows 10 with VS 2019 Preview. Can anyone of you guide me through this task?

I have download boost 1.70 but when I execute bootstrap.bat it gives the following message:

C:\libraries\boost\boost_1_70_0>bootstrap.bat
Building Boost.Build engine

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

C:\libraries\boost\boost_1_70_0>

this file have the following text in itself:

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>if exist bootstrap rd /S /Q bootstrap 

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>md bootstrap 

c:\libraries\boost\boost_1_70_0\tools\build\src\engine>cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib /Febootstrap\jam0  command.c compile.c constants.c debug.c execcmd.c execnt.c filent.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathnt.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c md5.c class.c cwd.c w32_getreg.c native.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c 
command.c
compile.c
constants.c
debug.c
execcmd.c
execnt.c
filent.c
frames.c
function.c
glob.c
hash.c
hdrmacro.c
headers.c
jam.c
jambase.c
jamgram.c
lists.c
make.c
make1.c
object.c
Generating Code...
Compiling...
option.c
output.c
parse.c
pathnt.c
pathsys.c
regexp.c
rules.c
scan.c
search.c
subst.c
timestamp.c
variable.c
modules.c
strings.c
filesys.c
builtins.c
md5.c
class.c
cwd.c
w32_getreg.c
Generating Code...
Compiling...
native.c
set.c
path.c
regex.c
property-set.c
sequence.c
order.c
Generating Code...

When I try the boost 1.68, I could run bootstrap.bat successfully, but when I execute b2.exe it gives me the following message:

warning: Did not find command for MSVC toolset. If you have Visual Studio 2017 installed you will need to specify the full path to the command, set VS150COMNTOOLS for your installation, or build from the 'Visual Studio Command Prompt for VS 2017'.

2 Answers2

9

You cannot currently build Boost with Preview, but you can with the regular 2019 just released. I had this same issue. It takes like ten minutes to install 2019 regular with required features. You can have both at the same time.

For future reference, here are my notes for how to build boost on windows with MPI and python support.

Building Boost on Windows with VS 2019

Need Visual Studio 2019 Non-Preview, any version, all the C++ and Windows SDK stuff.

Note: temporarily uninstall the C++ and Windows SDK stuff from VS Preview if you have both. Ideally have only one compiler on the system so Boost.build doesn't get confused.

Next, assuming you have git-for-windows installed, create an UPROTECTED folder called /Boost/. Inside it, execute

git clone https://github.com/boostorg/boost.git --recursive 

to clone the boost superproject repo. Next, execute

cd boost

Now you're in /Boost/boost. Checkout the developer branch (get recent updates) with

git checkout develop -f

Where -f forces updates.

Next we'll show how to run bootstrap inside the boost folder using Visual Studio Developer Console. To activate this console, either use the Windows search bar "Type here to search" for "Developer Command Prompt", or open visual studio and use the search bar at the top.

Note1: If you are getting access errors, you have to activate administrative visual studio developer console. Open cmd in administrative mode and run VsDevCmd.bat, the file that activates the visual studio developer console.

Note2: See comments about alternatively running bootstrap vc142 (or bootstrap vc<your visual-C++ version number>)

Now, execute:

bootstrap 

If you haven't already done so, install Microsoft MPI by installing both files available for latest version of Microsoft MPI. Its known to be working with Version 10, requires installing BOTH the SDK (an .msi file) and non-SDK (a .exe file) files to the DEFAULT locations. Do not modify these locations.

Then modify project-config.jam in the /Boost/boost/ directory to the following:

(btw, there is white space [a regular space] after each line, even empty lines)

# Boost.Build Configuration 
# Automatically generated by bootstrap.bat 
 
import option ; 
 
#latest toolset by default 
using msvc ; 

#in case you specified a toolset with bootstrap 
#using msvc: 14.2; 

option.set keep-going : false ; 
 
using python ; 
 
using mpi ; 

The last two lines assume you want mpi and python support.

Now open Visual Studio Developer Console and navigate (cd) to the boost folder /Boost/boost. Since we're using the Visual C++ compiler from VS 2019, apparently we don't need to b2 install anything (see sections 5.1 - 5.2 in the Getting Started guide). Then the only thing we need next is to run

b2 -j8 --address-model=64

Options include

  • --toolset=14.xx[to specify vs compiler version 14.15, etc] (or toolset without the --, someone told me, not sure which is correct please let me know, for me it was --. It's not needed if you ran bootstrap vc14x)
  • -a for rebuild all
  • -j8 for 8 cores compilation
  • --address-model=64 (or address-model without the --, someone told me, not sure which is correct please let me know, for me it was --) for 64-bit
  • > my_log.txt at the end to record the ridiculous amounts of text output from the build, for later use (making sure it went ok).
JoseOrtiz3
  • 1,785
  • 17
  • 28
  • I also used --address-model=64, but I had to run bootstrap vc142. Otherwise, it uses the latest toolset by default – ilciavo Feb 15 '23 at 13:51
0

I suspect that you are not building boost in a Visual Studio tools Command Prompt window.

See the answers I gave here: How to build 64-bit boost for visual studio on windows using the address-model flag? and here How to build Boost 1.64 in 64 bits?

kenba
  • 4,303
  • 1
  • 23
  • 40