Skip to content
20 changes: 20 additions & 0 deletions .github/workflows/libloading.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ jobs:
env:
TARGET: ${{ matrix.rust_target}}

msys2-test:
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- run: rustup install nightly --profile=minimal
- run: rustup default nightly
- run: rustup component add rust-src
- uses: msys2/setup-msys2@v2
with:
release: false
install: gcc
- run: echo "INPUT(libmsys-2.0.a)" | Out-File -FilePath "C:\msys64\usr\lib\libcygwin.a"
- run: |
$env:PATH = "C:\msys64\usr\bin\;$env:PATH"
cargo test --target x86_64-pc-cygwin -Zbuild-std
env:
CARGO_TARGET_X86_64_PC_CYGWIN_LINKER: x86_64-pc-msys-gcc.exe

bare-cross-build:
runs-on: ubuntu-latest
strategy:
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ all-features = true
rustdoc-args = ["--cfg", "libloading_docs"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(libloading_docs)'] }
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(libloading_docs)',
'cfg(target_os, values("cygwin"))',
] }
4 changes: 4 additions & 0 deletions src/os/unix/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ mod posix {
target_os = "redox",
target_os = "nto",
target_os = "hurd",
target_os = "cygwin",
))] {
pub(super) const RTLD_LAZY: c_int = 1;
} else {
Expand Down Expand Up @@ -127,6 +128,7 @@ mod posix {
target_os = "redox",
target_os = "nto",
target_os = "hurd",
target_os = "cygwin",
))] {
pub(super) const RTLD_NOW: c_int = 2;
} else if #[cfg(all(target_os = "android",target_pointer_width = "32"))] {
Expand All @@ -150,6 +152,7 @@ mod posix {
target_env = "uclibc",
all(target_os = "linux", target_arch = "mips"),
all(target_os = "linux", target_arch = "mips64"),
target_os = "cygwin",
))] {
pub(super) const RTLD_GLOBAL: c_int = 4;
} else if #[cfg(any(
Expand Down Expand Up @@ -224,6 +227,7 @@ mod posix {
target_os = "fuchsia",
target_os = "redox",
target_os = "hurd",
target_os = "cygwin",
))] {
pub(super) const RTLD_LOCAL: c_int = 0;
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/os/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ impl Library {
target_os = "solaris",
target_os = "illumos",
target_os = "redox",
target_os = "fuchsia"
target_os = "fuchsia",
target_os = "cygwin",
))] {
self.get_singlethreaded(symbol)
} else {
Expand Down
4 changes: 4 additions & 0 deletions tests/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ fn test_static_ptr() {
// the target. Especially since it is very unlikely to be fixed given the state of support its
// support.
#[cfg(not(all(target_arch = "x86", target_os = "windows", target_env = "gnu")))]
// Cygwin returns errors on `close`.
#[cfg(not(target_os = "cygwin"))]
fn manual_close_many_times() {
make_helpers();
let join_handles: Vec<_> = (0..16)
Expand Down Expand Up @@ -224,6 +226,8 @@ fn library_this_get() {
.get::<unsafe extern "C" fn()>(b"test_identity_u32")
.is_err());
// Something obscure from libc...
// Cygwin behaves like Windows so ignore it.
#[cfg(not(target_os = "cygwin"))]
assert!(this.get::<unsafe extern "C" fn()>(b"freopen").is_ok());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/library_filename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extern crate libloading;
use libloading::library_filename;
use std::path::Path;

#[cfg(target_os = "windows")]
#[cfg(any(target_os = "windows", target_os = "cygwin"))]
const EXPECTED: &str = "audioengine.dll";
#[cfg(target_os = "linux")]
const EXPECTED: &str = "libaudioengine.so";
Expand Down
Loading