How to Build Boost 1.64 in 64 Bits

Failed to build boost 1.64.0 b2.exe Visual Studio 2017

Of course...

set boost_dir=C:\Program Files\boost_1_64_0

must have "" to avoid the break. Silly Windows.
set boost_dir="C:\Program Files\boost_1_64_0"

and we start to build!

boost 1.69 visual studio 2017 64-bit

Despite the comments you show it seems to work and build the correct libraries.
For example it generates

libboost_stacktrace_windbg_cached-vc141-mt-x64-1_69.lib

building boost 1.64 for Visual Studio 2017

It is my understanding that changes by Microsoft to simplify deployment of VS2017 have caused serious problems with how Boost Build detects the toolset required to build Boost. My surmise is that this is what is preventing official support and/or causing problems. As of April 2017 it's clear that issues are still present with detecting VS2017 - see for example https://github.com/boostorg/build/issues/157 and http://boost.2283326.n4.nabble.com/VS2017-release-vswhere-exe-td4693141.html#a4693313. The silver lining is that Microsoft is aware and seems committed to resolving this. See https://lists.boost.org/Archives/boost/2017/04/234552.php.

Online information suggests work rounds exist using Powershell, but are non-trivial to say the least. Suggest anybody waiting for this follow the discussion, and voice urgency to Microsoft of resolving this for Boost 1.65.0. I am not personally trying this yet (notNeeded & notEnoughTime) but I am highly interested in a resolution and will come back to update if it looks like this is properly resolved.

Building boost 1.65.0: vcvarsall.bat not found

To update (and correct!) my previous answers on building boost, here are my latest notes for building boost on Windows for both Visual Studio and MinGw.

Windows does not directly support boost, so you can download it and put it wherever you want.

The boost user guide recommends creating a BOOST_ROOTenvironment variable with the location of boost.

Building for Visual Studio

In a Visual Studio tools Command Prompt:

cd boost_1_xx_0
call bootstrap.bat

For 64 bit static libraries (recommended for Windows):

b2 -j8 toolset=msvc address-model=64 link=static threading=multi runtime-link=shared --build-type=complete stage
2>&1 | tee msvc_static_build.txt

Note: the boost thread library must be built with dynamic linking see: https://studiofreya.com/2015/05/20/the-simplest-way-of-building-boost-1-58-for-32-bit-and-64-bit-architectures-with-visual-studio/

For 64 bit dynamic library (thread only):

b2 -j8 toolset=msvc address-model=64 link=shared threading=multi runtime-link=shared --with-thread --build-type=minimal stage
2>&1 | tee msvc_thread_build.txt

If you have multiple versions of Visual Studio installed and want to build for a specific version then use:

  • Visual Studio 2017: toolset=msvc-14.1
  • Visual Studio 2015: toolset=msvc-14.0
  • Visual Studio 2013: toolset=msvc-12.0
  • Visual Studio 2012: toolset=msvc-11.0
  • Visual Studio 2010: toolset=msvc-10.0

Note: when I built boost 1.65.0 for Visual Studio 2017 for 64 bit binaries, b2 output "building 32 bit: true", but it built 64 bit libraries...

Also note: whilst compiling a boost 1.65.0 include file in Visual Studio 2017 you may see the warning:

Unknown compiler version - please run the configure tests and report the results

This is because the latest version of Visual Studio 2017 defines _MSC_VER as 1911 whilst boost\config\compilier\visualc.hpp contains:

// last known and checked version is 19.10.25017 (VC++ 2017):
#if (_MSC_VER > 1910)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
# pragma message("Unknown compiler version - please run the configure tests and report the results")
# endif
#endif

To remove the warning, change line 325 of visualc.hpp to:

#if (_MSC_VER > 1911)

Building for MinGw

Ensure that mingw or gcc is in the path, e.g.: C:\Qt\Tools\mingw491_32\bin

cd boost_1_xx_0
call bootstrap.bat gcc

b2 toolset=gcc link=shared threading=multi --build-type=complete stage
2>&1 | tee mingw_build.txt

Note: for boost versions prior to 1.61 change bootstrap.bat gcc to bootstrap.bat mingw

Also note: 2>&1 | tee name.txt isn't necessary, but it's useful to keep a log...



Related Topics



Leave a reply



Submit