From 06a5a2ee182a0f6f0ec90b16549c02dcd039758d Mon Sep 17 00:00:00 2001 From: Tobias Kortkamp Date: Sun, 17 Mar 2019 10:49:25 +0100 Subject: [PATCH 1/3] 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 --- src/platform/linux/x11/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/platform/linux/x11/mod.rs b/src/platform/linux/x11/mod.rs index 5596297921..246c4c01ea 100644 --- a/src/platform/linux/x11/mod.rs +++ b/src/platform/linux/x11/mod.rs @@ -19,7 +19,13 @@ use std::collections::HashMap; use std::ffi::CStr; use std::ops::Deref; use std::os::raw::*; -use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBADF, __errno_location}; +use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBADF}; +#[cfg(target_os = "linux")] +use libc::__errno_location; +#[cfg(target_os = "freebsd")] +use libc::__error; +#[cfg(any(target_os = "netbsd", target_os = "openbsd"))] +use libc::__errno; use std::sync::{Arc, mpsc, Weak}; use std::sync::atomic::{self, AtomicBool}; @@ -232,7 +238,12 @@ impl EventsLoop { std::ptr::null_mut()); // timeout if err < 0 { + #[cfg(target_os = "linux")] let errno_ptr = __errno_location(); + #[cfg(target_os = "freebsd")] + let errno_ptr = __error(); + #[cfg(any(target_os = "netbsd", target_os = "openbsd"))] + let errno_ptr = __errno(); let errno = *errno_ptr; if errno == EINTR { From 23cebc7a961bc95b36ac30a52d59abecfc89d6b6 Mon Sep 17 00:00:00 2001 From: Tobias Kortkamp Date: Mon, 18 Mar 2019 17:07:02 +0100 Subject: [PATCH 2/3] Import __error / __errno on *BSD as __errno_location Signed-off-by: Tobias Kortkamp --- src/platform/linux/x11/mod.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/platform/linux/x11/mod.rs b/src/platform/linux/x11/mod.rs index 246c4c01ea..0200c71815 100644 --- a/src/platform/linux/x11/mod.rs +++ b/src/platform/linux/x11/mod.rs @@ -23,9 +23,9 @@ use libc::{select, fd_set, FD_SET, FD_ZERO, FD_ISSET, EINTR, EINVAL, ENOMEM, EBA #[cfg(target_os = "linux")] use libc::__errno_location; #[cfg(target_os = "freebsd")] -use libc::__error; +use libc::__error as __errno_location; #[cfg(any(target_os = "netbsd", target_os = "openbsd"))] -use libc::__errno; +use libc::__errno as __errno_location; use std::sync::{Arc, mpsc, Weak}; use std::sync::atomic::{self, AtomicBool}; @@ -238,12 +238,7 @@ impl EventsLoop { std::ptr::null_mut()); // timeout if err < 0 { - #[cfg(target_os = "linux")] let errno_ptr = __errno_location(); - #[cfg(target_os = "freebsd")] - let errno_ptr = __error(); - #[cfg(any(target_os = "netbsd", target_os = "openbsd"))] - let errno_ptr = __errno(); let errno = *errno_ptr; if errno == EINTR { From a56f643c8b4e948d428f588684a81f3c3e82954b Mon Sep 17 00:00:00 2001 From: Tobias Kortkamp Date: Thu, 21 Mar 2019 07:02:29 +0100 Subject: [PATCH 3/3] Add changelog entry Signed-off-by: Tobias Kortkamp --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8783afba1c..0fac2557ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased - On Windows, fix `CursorMoved(0, 0)` getting dispatched on window focus. +- On FreeBSD, NetBSD, and OpenBSD, fix build of X11 backend. # Version 0.19.0 (2019-03-06)