Skip to content

Building boost on windows

Mael Rouxel-Labbé edited this page Mar 28, 2024 · 1 revision

Abstract

If you are trying to use some features of the Classification package, you might encounter some CMake messages saying that "This project requires Boost ZLIB and Boost BZIP2, and will not be compiled." The reason for that is that the IO features in Classification require Boost IOStream to be compiled with bzip2 and zlib, and to ensure that it is the case, we check for the existence of boost_bzip2 and boost_zlib, which are bzip2 and zlib built by boost during the boost Build process. This page intends to explain how to produce those dependencies on Windows.

BZIP2 and ZLIB

You will need the sources for bzip2 and zlib before building boost. They can be found at the following places :

Building Boost

The full command is .\b2.exe -s NO_BZIP2=0 -s BZIP2_SOURCE="<bzip2_root_dir>" -s ZLIB_SOURCE="<zlib_root_dir>" -s NO_ZLIB=0 -j8 --toolset=msvc-14.2 --stagedir=stage64 address-model=64 link=shared --prefix="<target_installation_dir>" --with-thread --with-date_time --with-program_options --with-iostreams --with-filesystem --with-system --with-serialization install

The --with-xxx arguments list the modules we need for CGAL. -j8 is the argument for multi threading build, 8 stands for 8 cores. --toolset=msvc-14.2 the version of msvc used for the build --stagedir=stage64 and address-model=64 to use 64 bits link=shared to build shared libs and not static libs

-s NO_BZIP2=0 and -s NO_ZLIB=0 to not ignore the zlib and bzip2 compilations -s BZIP2_SOURCE="<bzip2_root_dir>" and -s ZLIB_SOURCE="<zlib_root_dir>" the paths to the source directories downloaded in the previous step.

This will build zlib and bzip2 from source, and use the result to build boost_io_stream.

Clone this wiki locally