12

Has anyone successfully built Boost using Visual Studio 2013 Express?

I'm confused as to whether or not this is possible just yet as the Boost website states:

Known Bugs with Visual Studio 2013/Visual C++ 12.

Visual Studio 2013 was released quite late in the release process, so there exist several unresolved issues. These include:

Serialization can't compile because of a missing include.

Using has_member_function_callable_with from Boost.Container's allocator_traits causes a compile error (#9332).

In libraries such as Unordered and MultiIndex, calling overloaded functions with initializer lists can result in a compile error, with Visual C++ claiming that the overloads are ambiguous. This is a Visual C++ bug and it isn't clear if there's a good workaround. This won't affect code that doesn't use initializer lists, or uses an initializer list that doesn't require an implicit conversion (i.e. an initializer list of the container's exact value type).

Thread: ex_scoped_thread compile fails (#9333).

However, this poster says it is possible to build Boost 1.55.0 using VS 2013 without any patches.

I have tried to build Boost using VS 2013 and I do indeed get at least the Serialization error.

Community
  • 1
  • 1
ksl
  • 4,519
  • 11
  • 65
  • 106

2 Answers2

18

I've recently built Boost on MSVC12 (VS2013) using only a minor patch:

Subject: [PATCH] Fixing boost serialization build on MSVC2013

include fix (manual)
config_decltype_n3276_new.patch (from https://svn.boost.org/trac/boost/ticket/9410)

As you can see it combines the patch from https://svn.boost.org/trac/boost/ticket/9410 with some manual include fixes (they were trivial).

This is the effective patch:

diff --git a/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp b/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp
index 5a5c7b7..8da85ee 100644
--- a/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp
+++ b/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp
@@ -29,6 +29,7 @@

#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/iterator_traits.hpp>
+#include <algorithm>

namespace boost { 
namespace archive {
diff --git a/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp b/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp
index 695fa94..1c0f4f0 100644
--- a/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp
+++ b/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp
@@ -180,13 +180,13 @@
#  define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#  define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#  define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+#  define BOOST_NO_CXX11_DECLTYPE_N3276
#endif

// C++11 features not supported by any versions
#define BOOST_NO_CXX11_CHAR16_T
#define BOOST_NO_CXX11_CHAR32_T
#define BOOST_NO_CXX11_CONSTEXPR
-#define BOOST_NO_CXX11_DECLTYPE_N3276
#define BOOST_NO_CXX11_NOEXCEPT
#define BOOST_NO_CXX11_UNICODE_LITERALS
#define BOOST_NO_SFINAE_EXPR
diff --git a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp
index 216300c..1c0e6c7 100644
--- a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp
+++ b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp
@@ -32,6 +32,6 @@

int main( int, char *[] )
{
-   return boost_no_decltype_n3276::test();
+   return boost_no_cxx11_decltype_n3276::test();
}

diff --git a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp
index 35427be..86e3664 100644
--- a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp
+++ b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp
@@ -27,11 +27,11 @@
#ifndef BOOST_NO_CXX11_DECLTYPE_N3276
#include "boost_no_decltype_n3276.ipp"
#else
-namespace boost_no_decltype_n3276 = empty_boost;
+namespace boost_no_cxx11_decltype_n3276 = empty_boost;
#endif

int main( int, char *[] )
{
-   return boost_no_decltype_n3276::test();
+   return boost_no_cxx11_decltype_n3276::test();
}

Serialization works nicely even with the EPA Portable Archive implementation

Disclaimer This is with 'regular' Visual Studio. It will probably work with VS Express. (if you have the Windows SDK)

sehe
  • 374,641
  • 47
  • 450
  • 633
  • @Mgetz are you sure you have the serialization library :/ If you don't use it, it's easy to miss that it failed to build – sehe Dec 28 '13 at 15:01
  • Could you possibly tell me how to apply this patch? – ksl Jan 01 '14 at 11:21
  • 2
    I could :) First off, you could just read it and apply it manually (it's human-readable, and only 9 lines in total). I've just cleaned the patch up a bit (there was a redundant patch file included by accident). For more directions, I'd suggest to [search on SO](http://stackoverflow.com/search?tab=votes&q=%5bpatch%5d%20apply). Good luck – sehe Jan 01 '14 at 13:40
  • @sehe Thanks very much for your help. I patched the files manually and then created my own patch files using svn-diff for future use. Probably not the most efficient way to arrive at my goal but I got there in the end. I can now build boost 1.55 using VS 2013. – ksl Jan 02 '14 at 11:58
1

I use BlueGo to build Boost directly form source, since Boost 1.55.0 cannot be build using VS2013 without applying a patch - but this bug is already fixed in the boost repository

Here you can see a screenshot of BlueGo - under the version combo box you can also select Build from Source

enter image description here

Vertexwahn
  • 7,709
  • 6
  • 64
  • 90