-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Build fails with musl because of wrong strerror_r() variant #1047
Comments
Thanks @joshuakraemer , |
|
Using function overloading is probably more portable than switching to |
Musl's documentation (https://www.musl-libc.org/doc/1.1.24/manual.html) says: _GNU_SOURCE (or _ALL_SOURCE) Adds everything above, plus interfaces modeled after GNU libc extensions and interfaces for making use of Linux-specific features. From reading that, it looks like you've found a gap between what Musl says it provides versus reality: they are not providing GNU's libc extension of |
The issue was discussed on the musl mailing list in 2013, and it seems that it was not considered to be a bug. This is what one of the musl developers said about it (https://www.openwall.com/lists/musl/2013/02/08/5):
In #1048, I have implemented an overloaded helper function to handle the different strerror_r() variants. This is probably the most portable solution (I think strerror_l() is missing in macOS). |
The function strerror_r() exists in a POSIX and a GNU variant. In https://github.com/dosbox-staging/dosbox-staging/blob/master/src/misc/support.cpp#L316, the GNU variant is chosen if _GNU_SOURCE is defined. However, the musl library only provides the POSIX variant, even if _GNU_SOURCE is defined. Thus, the wrong variant is chosen with musl, making the build fail:
As strerror_r() is deprecated anyway, I suggest to change to strerror_l(). See https://www.austingroupbugs.net/view.php?id=655:
Alternatively, C++ function overloading could be used instead of the macro test, see e.g. https://github.com/chriskohlhoff/asio/blob/master/asio/include/asio/impl/error_code.ipp#L189
Environment (please complete the following information):
Void Linux, x86_64, musl-1.1.24
Version of dosbox-staging:
649a428
The text was updated successfully, but these errors were encountered: