valpackett / systemstat

Rust library for getting system information | also on https://codeberg.org/valpackett/systemstat
https://crates.io/crates/systemstat
The Unlicense
610 stars 71 forks source link

Cross-compil from Linux to Windows failed #96

Closed Dalan94 closed 2 years ago

Dalan94 commented 2 years ago

When building my application which use systemstat from a Linux host to a windows target (cargo build --target=x86_64-pc-windows-gnu the linker failed (/usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -lIphlpapi). The problem is that the library in mingw is in totally in lowercase (iphlpapi) but the linker attribute (in socket.rs and network_interfaces.rs) has the first letter in uppercase (Iphlpapi). Could you change the linker attributes to make the build succeed. It shouldn't change the Windows behavior because the filename are case insensitive in Windows.

Regards

valpackett commented 2 years ago

We don't link anything directly here, I'm pretty sure this is part of the winapi crate.

Dalan94 commented 2 years ago

There is 2 link attribute for iphlpapi: https://github.com/unrelentingtech/systemstat/blob/ad3a0a2c1e0577dd28b9a653d352f31a34528123/src/platform/windows/socket.rs#L40 https://github.com/unrelentingtech/systemstat/blob/ad3a0a2c1e0577dd28b9a653d352f31a34528123/src/platform/windows/socket.rs#L40 I tried to put them in lowercase and it work well.

valpackett commented 2 years ago

oh, haven't checked socket. Can you send a pull request?