Skip to content

Commit a07fec9

Browse files
authored
Re-enable several cross-compilation targets in CI. (#1145)
* Re-enable several cross-compilation targets in CI. These targets previously had breakage on nightly, but appear to build now. This requires enabing more of rustix::ffi on Windows. * Enable fix_y2038 for aarch64-unknown-linux-gnu_ilp32. * Fix compilation on other targets.
1 parent 592fea1 commit a07fec9

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -208,34 +208,25 @@ jobs:
208208
- run: rustup component add rust-src
209209
- run: cargo check -Z build-std --target x86_64-unknown-openbsd --all-targets --features=all-apis
210210
- run: cargo check -Z build-std --target mips64-openwrt-linux-musl --all-targets --features=all-apis
211-
# Temporarily disable this because the target appears to have breakage on nightly.
212-
# - run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis
211+
- run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis
213212
- run: cargo check -Z build-std --target sparc-unknown-linux-gnu --all-targets --features=all-apis
214-
# Temporarily disable this because the target appears to have changed and needs
215-
# fixes and we transitively dev-depend on what can be an older version of rustix.
216-
#- run: cargo check -Z build-std --target armv7-unknown-freebsd --all-targets --features=all-apis
217-
# Omit --all-targets on gnu_ilp32 because dev-dependency tempfile depends on an older rustix
218-
- run: cargo check -Z build-std --target aarch64-unknown-linux-gnu_ilp32 --features=all-apis
213+
- run: cargo check -Z build-std --target armv7-unknown-freebsd --all-targets --features=all-apis
214+
- run: cargo check -Z build-std --target aarch64-unknown-linux-gnu_ilp32 --all-targets --features=all-apis
219215
# Omit --all-targets on haiku because not all the tests build yet.
220-
# Temporarily disable this because the target appears to have breakage on nightly.
221-
#- run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis
222-
# Temporarily disable this because the target appears to have breakage on nightly.
223-
#- run: cargo check -Z build-std --target x86_64-uwp-windows-msvc --all-targets --features=all-apis
216+
- run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis
217+
- run: cargo check -Z build-std --target x86_64-uwp-windows-msvc --all-targets --features=all-apis
224218
# Temporarily disable riscv32imc-esp-espidf due to std using SOMAXCONN.
225219
#- run: cargo check -Z build-std --target=riscv32imc-esp-espidf --features=all-apis
226220
- run: cargo check -Z build-std --target=aarch64-unknown-nto-qnx710 --features=all-apis
227221
- run: cargo check -Z build-std --target=x86_64-pc-nto-qnx710 --features=all-apis
228222
# Temporarily disable --features=all-apis, which doesn't build yet.
229-
# Temporarily disable this because the target appears to have breakage on nightly.
230-
#- run: cargo check -Z build-std --target=armv6k-nintendo-3ds
223+
- run: cargo check -Z build-std --target=armv6k-nintendo-3ds
231224
# Temporarily disable armv7-sony-vita-newlibeabihf due to std using SOMAXCONN.
232225
#- run: cargo check -Z build-std --target=armv7-sony-vita-newlibeabihf --features=all-apis
233226
# `std` doesn't appear to build on AIX yet, so test in `no_std` mode.
234227
- run: cargo check -Zbuild-std=core,alloc --target=powerpc64-ibm-aix --features=all-apis --no-default-features
235-
# Disable MIPS entirely for now as it fails with errors like
236-
# "Undefined temporary symbol $BB342_17".
237-
#- run: cargo check -Z build-std --target=mipsel-unknown-linux-gnu --features=all-apis
238-
#- run: cargo check -Z build-std --target=mips64el-unknown-linux-gnuabi64 --features=all-apis
228+
- run: cargo check -Z build-std --target=mipsel-unknown-linux-gnu --features=all-apis
229+
- run: cargo check -Z build-std --target=mips64el-unknown-linux-gnuabi64 --features=all-apis
239230

240231

241232
test:

build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fn main() {
1212
// Gather target information.
1313
let arch = var("CARGO_CFG_TARGET_ARCH").unwrap();
1414
let env = var("CARGO_CFG_TARGET_ENV").unwrap();
15+
let abi = var("CARGO_CFG_TARGET_ABI");
1516
let inline_asm_name = format!("{}/{}.rs", ASM_PATH, arch);
1617
let inline_asm_name_present = std::fs::metadata(inline_asm_name).is_ok();
1718
let os = var("CARGO_CFG_TARGET_OS").unwrap();
@@ -148,13 +149,15 @@ fn main() {
148149
|| arch == "mips"
149150
|| arch == "sparc"
150151
|| arch == "x86"
151-
|| (arch == "wasm32" && os == "emscripten"))
152+
|| (arch == "wasm32" && os == "emscripten")
153+
|| (arch == "aarch64" && os == "linux" && abi == Ok("ilp32".to_string())))
152154
&& (apple
153155
|| os == "android"
154156
|| os == "emscripten"
155157
|| os == "haiku"
156158
|| env == "gnu"
157-
|| (env == "musl" && arch == "x86"))
159+
|| (env == "musl" && arch == "x86")
160+
|| (arch == "aarch64" && os == "linux" && abi == Ok("ilp32".to_string())))
158161
{
159162
use_feature("fix_y2038");
160163
}

src/ffi.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
//! Utilities related to FFI bindings.
22
33
// If we have std, use it.
4+
#[cfg(windows)]
5+
#[cfg(feature = "std")]
6+
pub use std::os::raw::{c_char, c_int, c_long, c_short, c_uint, c_ulong, c_ushort};
7+
#[cfg(not(windows))]
48
#[cfg(feature = "std")]
59
pub use {
610
std::ffi::{CStr, CString, FromBytesWithNulError, NulError},
@@ -9,7 +13,12 @@ pub use {
913

1014
// If we don't have std, we can depend on core and alloc having these features
1115
// in Rust 1.64+.
16+
#[cfg(not(windows))]
1217
#[cfg(all(feature = "alloc", not(feature = "std")))]
1318
pub use alloc::ffi::{CString, NulError};
19+
#[cfg(windows)]
20+
#[cfg(not(feature = "std"))]
21+
pub use core::ffi::{c_char, c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void};
22+
#[cfg(not(windows))]
1423
#[cfg(not(feature = "std"))]
1524
pub use core::ffi::{c_char, CStr, FromBytesWithNulError};

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ pub mod fd {
198198
#[cfg(feature = "event")]
199199
#[cfg_attr(docsrs, doc(cfg(feature = "event")))]
200200
pub mod event;
201-
#[cfg(not(windows))]
202201
pub mod ffi;
203202
#[cfg(not(windows))]
204203
#[cfg(feature = "fs")]

0 commit comments

Comments
 (0)