Description
Seeing @bitbegin's issue (#17), I tried to use the GNU toolchain, but ended up with an error.
I'm on Windows 10 Home 64 bit.
- Switched to the GNU based toolchain:
rustup override set stable-x86_64-pc-windows-gnu
- Installed
pkg-config-lite
- Set
%PATH%
topkg-config-lite-0.28-1\bin
- Set
%PKG_CONFIG_PATH%
topkg-config-lite-0.28-1\libs
I created - Verified
pkg-config
was working usingpkg-config -v
- Donwloaded
libusb
for Windows by clicking Downloads > Latest Windows binaries - Created a
libusb.pc
file in thePKG_CONFIG_PATH
directory:
# libusb.pc
prefix=C:/Users/Tom/Desktop/pkg-config-lite-0.28-1/libs/libusb
exec_prefix=${prefix}
includedir=${prefix}/include/libusb-1.0
libdir=${exec_prefix}/MinGW64/dll # `/dll`?
Name: libusb
Description: libusb
Version: 1.0
Cflags: -I${includedir}
Libs: -L${libdir} -llibusb-1.0
Here's what pkg-config --libs --cflags libusb-1.0
spits out for me:
-IC:/Users/Tom/Desktop/pkg-config-lite-0.28-1/libs/libusb/include/libusb-1.0 -LC:/Users/Tom/Desktop/pkg-config-lite-0.28-1/libs/libusb/MinGW64/dll -llibusb-1.0
I am using this example code based on what's in the README.md
file of this repository:
extern crate libusb;
fn main() {
let context = libusb::Context::new().unwrap();
for device in context.devices().unwrap().iter() {
let device_desc = device.device_descriptor().unwrap();
println!("Bus {:03} Device {:03} ID {:04x}:{:04x}",
device.bus_number(),
device.address(),
device_desc.vendor_id(),
device_desc.product_id());
}
println!("Hello, world!");
}
Running cargo run
then links just fine and runs the binary which subsequently fails with the 3221225781
exit code, which is 0xC0000135
, which means STATUS_DLL_NOT_FOUND
.
I suspect this is because I am using the dll
directory, not the static
directory, but with that one, I just get linked errors.
@dcuddeback would you be able to advise here?