Can't build from source on osx 10.13.2

osx 10.13.2
xcode 9.2
git # of vcmi c2a0b133328f3bfc0619ac339000ec44033cd66e

Followed the steps for “Building VCMI in command line with Makefiles” from https://wiki.vcmi.eu/How_to_build_VCMI_(macOS), getting errors after 52% starting with this one:

/usr/local/include/boost/asio/basic_socket_acceptor.hpp:71:1: error: too few template parameters in template redeclaration
template <typename Protocol
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/apovkh/projects/homm3/vcmi/lib/serializer/Connection.h:32:3: note: previous template declaration is here
                template <typename Protocol,typename SocketAcceptorService>
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tried to dig into the issue but neither basic_socket_acceptor.hpp nor Connection.h has been updated in a while, so possible an environment issue? I’m not a cpp expert, but shouldn’t it be the other way - Connection.h should redeclare the declaration from basic_socket_acceptor.hpp and not the opposite as the error message suggests?

Similar error when building using xcode:

In file included from /Users/apovkh/projects/homm3/vcmi/lib/serializer/Connection.cpp:17:
In file included from /usr/local/include/boost/asio.hpp:30:
/usr/local/include/boost/asio/basic_socket_acceptor.hpp:71:1: error: too few template parameters in template redeclaration
template <typename Protocol
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/apovkh/projects/homm3/vcmi/lib/serializer/Connection.cpp:11:
/Users/apovkh/projects/homm3/vcmi/lib/serializer/Connection.h:32:3: note: previous template declaration is here
                template <typename Protocol,typename SocketAcceptorService>
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Turns out the problem is related to 1.66.0 version of boost - http://www.boost.org/users/history/version_1_66_0.html

The service template parameters, and the corresponding classes, are disabled by default. For example, instead of basic_socket<Protocol, SocketService> we now have simply basic_socket. The old interface can be enabled by defining the BOOST_ASIO_ENABLE_OLD_SERVICES macro.

Downgrading to 1.65.1 solved the issue (how to downgrade: http://zoltanaltfatter.com/2017/09/07/Install-a-specific-version-of-formula-with-homebrew/)

2 Likes

Just in case am I getting it right that if we to define BOOST_ASIO_ENABLE_OLD_SERVICES it’s will let us avoid issues at least until we make code compatible with newer Boost?

That sounds right

1 Like