Skip to content
Alexander Saprykin edited this page Apr 14, 2016 · 28 revisions

Windows

Configuration 1

  • Version: Windows 7 SP1 (x64).
  • Compilers: MinGW GCC 5.3.0 (x86, x64), Clang 3.8.0 (x64), Intel XE 2013 (x86, x64), Visual Studio (VS) 2012 (x86, x64), Visual Studio 2015 (x86, x64).
  • Status: Compiled (MinGW, Clang, Intel, VS2012, VS2015).
  • Tests: Passed (MinGW, Clang, Intel, VS2012, VS2015).

Configuration 2

  • Version: Windows XP SP3 (x86).
  • Compilers: Open Watcom 1.9 (x86), Borland 5.82 (x86), VS2010 (x86).
  • Status: Compiled (Open Watcom, Borland, VS2010).
  • Tests: Not run (Open Watcom), Passed (Borland, VS2010).

Regular test builds are run on AppVeyor.

If you need IPv6 support on Windows XP you must enable it manually using the following command: netsh int ipv6 install. Without enabled IPv6 all calls related to IPv6 addresses and sockets will fail.

MinGW

MinGW-W64 is an advance of the original MinGW project to provide GCC support on Windows including 64-bit API. It has easy-to-use online installer where you can select all required packages. You should have no problems with compilation using MinGW-W64.

MSYS2 provides POSIX environment to build native Windows binaries. After installing core MSYS2 distribution you need to install required MinGW-W64 toolchains and utilities: look for mingw-w64-i686-* and mingw-w64-x86_64-* package prefixes. You need at least GCC and make utility which provides mingw32-make binary. CMake and Boost are also available for the each of toolchains. You may need to explicitly pass to CMake name of the make utility and project generator: -DCMAKE_MAKE_PROGRAM=mingw32-make -G"Unix Makefiles". You can read more about MSYS2 on its page.

MinGW-W64 (GCC) builds from the MSYS2 distribution may have some problems with optimizations which can lead compiled programs to unpredictable crashes. In that case you can try to compile code with -fno-aggressive-loop-optimizations flag (introduced in GCC 4.8.0).

Note. You must use MinGW-W64 shell to build native binaries, do not use MSYS2 shell directly.

Clang

Clang on Windows is still some sort of an exotic, but the situation is better with the every release. There are three general ways to use Clang on Windows:

  • Starting from Visual Studio 2015 Update 1 Microsoft offers out-of-the box Clang experience. Read about Clang support in Visual Studio. You can also read more about supported features. Actually it is a Clang parser with Visual Studio's code generator and optimizer. This way has problems with Boost compiling (it seems that Boost treats such a compiler as pure MSVC).
  • Official Windows builds of Clang add custom toolsets into Visual Studio (i.e. LLVM-vs2014). In the newer versions of CMake you can pass toolset name using -T option. This way you can use original Clang compiler for Visual Studio projects. Latest CMake refuses to work with these toolsets.
  • MSYS2 provides prebuilt packages of the latest Clang versions. Use pacman to install it. It is a native Clang compiler and the most easiest and good working path. Though it is working only for x64 builds.

If you are going to build Clang by yourself this manual is quite a good starting point.

Intel

Using Intel C/C++ compiler is straightforward: setup development environment using supplied scripts with appropriate Visual Studio version and target architecture (Intel doesn't supply linker). Run _CMake from the prepared environment and point out path to Intel C/C++ compiler for selected target architecture.

Visual Studio

Using Visual Studio is really easy: run CMake, choose required solution generator, run it and open generated solution in Visual Studio. If you are building on old Windows versions (i.e. Windows XP) you may need to pass _WIN32_WINNT and NTDDI_VERSION constants to compiler flags to disable unsupported APIs. This is especially important if you are using newer SDKs (i.e. 7.0a). Also take attention that you must define NTDDI_VERSION properly or it fails to work: in most cases it should be the same as _WIN32_WINNT plus four zeros. I have also encountered situations when SDK's headers were broken, i.e. unsupported APIs were not wrapped with conditional checking for target Windows versions. You can read more about using Windows headers on MSDN.

Open Watcom

Open Watcom is an open source compiler with cross-compiling support. It is not officially supported by Boost so I'm not able to run tests though the library itself compiles fine.

Borland

Borland C++ is a compiler developed by Borland and CodeGear. Now it is developed by Embarcadero. I do not recommend you to use versions prior 5.7 (Borland C++ Builder 2006) because they have brain-damaged socket subsystem implementation which is not fully compatible with WinSock2 behavior. Those old versions are not fully supported by Boost.

Clone this wiki locally