-
Notifications
You must be signed in to change notification settings - Fork 913
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
Fix build on FreeBSD #815
Fix build on FreeBSD #815
Conversation
An alternative solution might be to use the errno crate to access |
Hi, thanks for the PR! Just as a stylistic nitpick, maybe it'd be better to just rename the imports, to avoid littering I'm thinking something like: #[cfg(target_os = "linux")]
use libc::__errno_location;
#[cfg(target_os = "freebsd")]
use libc::__error as __errno_location;
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
use libc::__errno as __errno_location; Do we have any strong stylistic constraints wrt to this ? @francesca64 @Osspial ? |
I've changed it as you've suggested. Anything else I can to do to get this merged? |
The only thing I can see blocking this is a lack of changelog entry. We should be able to merge this once that's added in. |
Added one. |
error[E0432]: unresolved import `libc::__errno_location` --> src/platform/linux/x11/mod.rs:22:85 | 22 | use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBADF, __errno_location}; | ^^^^^^^^^^^^^^^^ no `__errno_location` in the root __errno_location is called __error on FreeBSD and __errno on Open- and NetBSD. Signed-off-by: Tobias Kortkamp <[email protected]>
Signed-off-by: Tobias Kortkamp <[email protected]>
Signed-off-by: Tobias Kortkamp <[email protected]>
* Fix build on FreeBSD error[E0432]: unresolved import `libc::__errno_location` --> src/platform/linux/x11/mod.rs:22:85 | 22 | use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBADF, __errno_location}; | ^^^^^^^^^^^^^^^^ no `__errno_location` in the root __errno_location is called __error on FreeBSD and __errno on Open- and NetBSD. Signed-off-by: Tobias Kortkamp <[email protected]> * Import __error / __errno on *BSD as __errno_location Signed-off-by: Tobias Kortkamp <[email protected]> * Add changelog entry Signed-off-by: Tobias Kortkamp <[email protected]>
* Fix build on FreeBSD error[E0432]: unresolved import `libc::__errno_location` --> src/platform/linux/x11/mod.rs:22:85 | 22 | use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBADF, __errno_location}; | ^^^^^^^^^^^^^^^^ no `__errno_location` in the root __errno_location is called __error on FreeBSD and __errno on Open- and NetBSD. Signed-off-by: Tobias Kortkamp <[email protected]> * Import __error / __errno on *BSD as __errno_location Signed-off-by: Tobias Kortkamp <[email protected]> * Add changelog entry Signed-off-by: Tobias Kortkamp <[email protected]>
* Fix build on FreeBSD error[E0432]: unresolved import `libc::__errno_location` --> src/platform/linux/x11/mod.rs:22:85 | 22 | use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBADF, __errno_location}; | ^^^^^^^^^^^^^^^^ no `__errno_location` in the root __errno_location is called __error on FreeBSD and __errno on Open- and NetBSD. Signed-off-by: Tobias Kortkamp <[email protected]> * Import __error / __errno on *BSD as __errno_location Signed-off-by: Tobias Kortkamp <[email protected]> * Add changelog entry Signed-off-by: Tobias Kortkamp <[email protected]>
* Fix build on FreeBSD error[E0432]: unresolved import `libc::__errno_location` --> src/platform/linux/x11/mod.rs:22:85 | 22 | use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBADF, __errno_location}; | ^^^^^^^^^^^^^^^^ no `__errno_location` in the root __errno_location is called __error on FreeBSD and __errno on Open- and NetBSD. Signed-off-by: Tobias Kortkamp <[email protected]> * Import __error / __errno on *BSD as __errno_location Signed-off-by: Tobias Kortkamp <[email protected]> * Add changelog entry Signed-off-by: Tobias Kortkamp <[email protected]>
__errno_location is called __error on FreeBSD and __errno on Open- and NetBSD.
Note that I only tested on FreeBSD. The OpenBSD and NetBSD bits are a pure guess on my part based on libc documentation and their errno.h [2,3,4,5].
[1] FreeBSD: https://rust-lang.github.io/libc/x86_64-unknown-freebsd/libc/fn.__error.html
[2] NetBSD: https://rust-lang.github.io/libc/x86_64-unknown-netbsd/libc/fn.__errno.html
[3] NetBSD: https://github.com/NetBSD/src/blob/trunk/include/errno.h
[4] OpenBSD: https://rust-lang.github.io/libc/x86_64-unknown-openbsd/libc/fn.__errno.html
[5] OpenBSD: https://github.com/OpenBSD/src/blob/master/include/errno.h