Skip to content

Commit 8f80afb

Browse files
committed
Fix deps
* Do not list the libc minimal version on signal-hook, the aix change that prompted it is for signal-hook-registry. * Do not force it for that one either. That would break our (arguably too conservative) minimal rust version. However, hint to the AIX user that upgrading their libc might be a good idea. * Also mention in docs that to actually compile the crate on such an ancient version of rust, they need to keep libc old too. See #169.
1 parent 9ac6186 commit 8f80afb

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ members = [
3434
]
3535

3636
[dependencies]
37-
libc = "^0.2.171"
37+
libc = "^0.2"
3838
signal-hook-registry = { version = "^1.4", path = "signal-hook-registry" }
3939

4040
[dev-dependencies]

signal-hook-registry/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ travis-ci = { repository = "vorner/signal-hook" }
1818
maintenance = { status = "actively-developed" }
1919

2020
[dependencies]
21-
libc = "~0.2"
21+
libc = "^0.2"
2222

2323
[dev-dependencies]
2424
signal-hook = { version = "~0.3", path = ".." }

signal-hook-registry/src/lib.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
//! require dependencies that don't build there, so tests need newer Rust version (they are run on
4040
//! stable).
4141
//!
42+
//! Note that this ancient version of rustc no longer compiles current versions of `libc`. If you
43+
//! want to use rustc this old, you need to force your dependency resolution to pick old enough
44+
//! version of `libc` (`0.2.156` was found to work, but newer ones may too).
45+
//!
4246
//! # Portability
4347
//!
4448
//! This crate includes a limited support for Windows, based on `signal`/`raise` in the CRT.
@@ -158,7 +162,23 @@ impl Slot {
158162
fn new(signal: libc::c_int) -> Result<Self, Error> {
159163
// C data structure, expected to be zeroed out.
160164
let mut new: libc::sigaction = unsafe { mem::zeroed() };
161-
new.sa_sigaction = handler as usize;
165+
166+
// Note: AIX fixed their naming in libc 0.2.171.
167+
//
168+
// However, if we mandate that _for everyone_, other systems fail to compile on old Rust
169+
// versions (eg. 1.26.0), because they are no longer able to compile this new libc.
170+
//
171+
// There doesn't seem to be a way to make Cargo force the dependency for only one target
172+
// (it doesn't compile the ones it doesn't need, but it stills considers the other targets
173+
// for version resolution).
174+
//
175+
// Therefore, we let the user have freedom - if they want AIX, they can upgrade to new
176+
// enough libc. If they want ancient rustc, they can force older versions of libc.
177+
//
178+
// See #169.
179+
180+
new.sa_sigaction = handler as usize; // If it doesn't compile on AIX, upgrade the libc dependency
181+
162182
// Android is broken and uses different int types than the rest (and different depending on
163183
// the pointer width). This converts the flags to the proper type no matter what it is on
164184
// the given platform.

0 commit comments

Comments
 (0)