crossbario / autobahn-cpp

WAMP for C++ in Boost/Asio
https://crossbar.io/autobahn
Boost Software License 1.0
251 stars 104 forks source link

Fix link error in provide_prefix with some compilers #212

Closed robinlinden closed 3 years ago

robinlinden commented 3 years ago

Serializing arrays require providing a zone to msgpack for it to be happy (sometimes).

My commit adding CI was based on a commit older than the one where I fixed the provide_prefix example not being compiled, so I didn't notice it was broken when I tested things.

I also can't reproduce the linker error locally, but it seems that msgpack always requires a zone when the type you serialize maps to a MAP or ARRAY, and on CI "prefix" mapped to char[7], so that's an array in msgpack, I suppose.

See: https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object

The error:

/usr/bin/ld: CMakeFiles/provide_prefix.dir/provide_prefix.cpp.o: in function `msgpack::v2::object::object<char [7]>(char const (&) [7])':
/usr/include/msgpack/v2/object_fwd.hpp:36: undefined reference to `void msgpack::v1::operator<< <char, 7ul>(msgpack::v2::object&, char const (&) [7ul])'
oberstet commented 3 years ago

+1

OT: not sure if you noticed https://github.com/crossbario/autobahn-cpp/issues/206 - different users, more opinions;)

robinlinden commented 3 years ago

Ah, yeah, I don't think the library should move to C++20-only. I was only explaining why I didn't use the nicer [=, this] syntax. :) It might be nice to have a setting to use std::future instead of boost::future though? At least if they reach feature-parity in C++23, for now all of that nice stuff is experimental.

See: http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0443r7.html, https://en.cppreference.com/w/cpp/experimental/future