asio icon indicating copy to clipboard operation
asio copied to clipboard

Issue building for msys2/cygwin

Open pps83 opened this issue 8 months ago • 0 comments

For testing reasons, I build my app also using cygwin. Pretty much everything worked out of the box except something that I wouldn't expect to fail: boost-asio. The problem is: it erroneously considers cygwin to be windows, while it's a posix-like build, shouldn't have anything windows related at all!

For example:

// boost/asio/detail/config.hpp
#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
...

this right here is wrong. __CYGWIN__ could be treated like linux, not windows (it does define __unix__ for instance)! Using cygwin shell, one might cross compile to proper windows using mingw/mingw64, but such build tools won't define __CYGWIN__! (they will define _WIN32, __MINGW32__ etc).

Similarly to __CYGWIN__, there is also msys2 shell (which is basically cygwin port). With msys2 shell (when $MSYSTEM is set to to MSYS, not any of the mingw/ucrt64 shells) it's basically the same: it also defines __CYGWIN__, __unix__, and __MSYS__ (in case if anybody wanted to distinguish it from real cygwin, but that shouldn't be needed).

So, in short, imo entire build config of asio is wrong for cygwin, that's why it fails if you try to build boost from sources using b2 or simply try to include asio when building in cygwin or msys2.

pps83 avatar Apr 22 '25 00:04 pps83