Use Boost.Hana via vcpkg with the latest MSVC compiler

Overview

As we continue to work towards improving the conformance of the MSVC compiler for the C++ community, we would like to enable more C++ libraries, and today we are bringing Boost.Hana to Visual C++.  Building on our recent C++ conformance progress, customers can now use Boost.Hana with the VS2017 15.7 update after we’ve applied some source workarounds in the vcpkg version. We want to thank the author of Boost.Hana, Louis Dionne, for working with us on this effort and for extending his support.

How do I get it?

  • Go to the vcpkg repo on GitHub and follow the instructions in the README.md
  • We created a new fork of Boost.Hana and redirected vcpkg to that fork
  • After you’ve built vcpkg, then run this command to install Boost.Hana:
    • vcpkg.exe install boost-hana
    • You will see this disclaimer during the installation of Boost on Windows: “The current MSVC releases can’t compile boost hana yet. Use a fork from boost 1.67 which has source workarounds instead.”

Background

You may have seen our VCBlog post about C++ conformance completion for our compiler with the recent VS2017 update. As of early June 2018, MSVC cannot build the master branch of Boost.Hana due to several blocking bugs. We started working on that two years ago and have since fixed around 40 compiler bugs exposed by the library. We hit some blocking issues in constexpr, so the effort was halted for a while until we made sufficient progress recently in C++14 and C++17 constexpr conformance with the VS2017 15.7 release.

We have revisited the status recently and most of the blocking constexpr issues are fixed in the VS2017 15.7 update. There are still outstanding issues in multiple feature areas within the compiler that prevent us from building Boost.Hana.

While work remains to be done in the compiler, because of the heavy demand for this library from our customers, we have made source workarounds in Boost.Hana for the remaining compiler bugs. This was needed so we can have complete test coverage of all the known issues. We are now building it in our daily testing repertoire to maintain regression-free compiler development while we progress toward achieving one-to-one parity with the public library sources.

After discussing this issue with Louis, we’ve jointly agreed to provide a version of Boost.Hana in vcpkg to promote usage of the library among more C++ users from the Visual C++ community. This includes the patches we previously identified, and as we fix the remaining bugs, we’ll gradually update the version of Boost.Hana in vcpkg, ultimately removing it and replacing it with master as the bugs are fixed. We think we’re close enough with our efforts that we can conduct this progress publicly in vcpkg without hindering new users who take a dependency on the library.

 Again, a huge THANKS to Louis for being willing to take bug reports on Hana and quickly resolving them, which greatly sped up our progress. 

Source workarounds in place

  • MSVC-specific source workarounds appear in 70 places: 27 in the library itself, 20 in the tests, and 23 in the examples.
  • These are all under unique macro definitions that are prefixed with “BOOST_HANA_WORKAROUND_MSVC_” and postfixed with a specific bug ID number from our internal database for each issue. Full details for more information.
  • Here are some examples:

Compiler bugs

  • There are 25 active bugs with the VS2017 15.7 update.
  • We plan to fix them all by the VS2017 15.9 update.

What’s next…

  • Throughout the remaining updates of Visual Studio 2017, we will exhaust the remaining MSVC bugs that block upstream versions of the Boost.Hana library. As we fix bugs, we will gradually update the corresponding source workarounds.
  • We will continue to provide status updates on our progress.
  • We will ensure that users who take a dependency on this library in vcpkg will not be affected by our work.
  • What about Range-v3?
    • Similarly, we are tracking all Range-v3 blocking bugs in the compiler and have plans to fix them in the remaining Visual Studio 2017 updates.