From cb93554938f80b327bc73700c2fc33fd01649690 Mon Sep 17 00:00:00 2001 From: Tobias Kortkamp Date: Fri, 22 Mar 2019 15:44:00 +0100 Subject: [PATCH] Fix build on FreeBSD (#815) * 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 * Import __error / __errno on *BSD as __errno_location Signed-off-by: Tobias Kortkamp * Add changelog entry Signed-off-by: Tobias Kortkamp --- CHANGELOG.md | 1 + src/platform_impl/linux/x11/mod.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 725253d6..d62c34ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - Removed `serde` implementations from `ControlFlow`. - 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) diff --git a/src/platform_impl/linux/x11/mod.rs b/src/platform_impl/linux/x11/mod.rs index a98556c1..1cd1bd56 100644 --- a/src/platform_impl/linux/x11/mod.rs +++ b/src/platform_impl/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 as __errno_location; +#[cfg(any(target_os = "netbsd", target_os = "openbsd"))] +use libc::__errno as __errno_location; use std::sync::{Arc, mpsc, Weak}; use std::sync::atomic::{self, AtomicBool};