-
-
Notifications
You must be signed in to change notification settings - Fork 2k
add a workaround to mingw / libstdc++ issue 68307 #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This is a workaround to some standard non-conformance defect in libstdc++ headers for mingw. Although the C++11 standard requires that `std::errc::operation_canceled` is an enumerator value of `std::errc` in `<system_error>`, and asio library uses std::errc when compiled as standalone, mingw apparently doesn't use all the std::errc signals, and doesn't define any of the enumerators that it doesn't use. Presumably mingw instead packs these signals into some different error codes or something, it's not entirely clear. Regardless, even if there are some low-level issues in mingw implementations of sockets, websocketpp is a bit higher level library and one would think that we should be able to try to run websocketpp over any given sockets implementation and at least get it to compile. This patch is a polyfill so that if for whatever reason the host system fails to define this error code symbol, websocketpp will just return false whenever testing if an error code matches it, as a form of special support for mingw. (Or any other toolchain that happens to have a similar bug -- there is no ifdef going on here.) In preliminary tests, websocketpp examples seem to work fine with this patch when compiled with the mingw-w64 toolchain from ubuntu trusty repo, with Asio standalone and C++11 standard, when running in wine on my machine.
Hi, I'm trying to use websocketpp (version 0.7.0) in MAME, but I think I'm hitting this issue: https://tea-ci.org/mamedev/mame/3509 i.e., when compiling on mingw, I get the error that this pull request is intended to fix: In file included from ../../../../../3rdparty/websocketpp/websocketpp/config/asio_no_tls.hpp:32:0, |
Hi, as a follow up, Jonathan Wakely has merged a fix for this into libstdc++ trunk. He says it might be backported to gcc 5.4 and 5.3: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71444 I did not test myself if this fixes websocketpp cross-compilation. |
This is a follow up to issue #478 .
After discussion with mingw folks they agree that it's a problem but it's
not clear exactly how they are going to fix it and how easily a patch
would be available downstream, i.e. if it would require building mingw
from sources instead of just getting it from some linux package manager.
Since it requires patching libstdc++ apparently, I tend to assume it could
take a while.
Therefore my plan in my project is to take websocketpp in-tree and insert
a workaround which would be noninvasive and not change behavior for
other platforms.
I decided to cookup something using SFINAE that detects if the
lib::asio::errc
enum is missing the value it is supposed to have, and replacethe websocketpp check for equality with this, with
false
when it is missing.I thought I would send this patch upstream for your review, to see what you
think etc. I guess if you are only interested to target strictly conforming C++11
implementations then you might not want to carry the patch, but anyway it's
for you to decide.