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% to pkg-config-lite-0.28-1\bin
- Set
%PKG_CONFIG_PATH% to pkg-config-lite-0.28-1\libs I created
- Verified
pkg-config was working using pkg-config -v
- Donwloaded
libusb for Windows by clicking Downloads > Latest Windows binaries
- Created a
libusb.pc file in the PKG_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?
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.
rustup override set stable-x86_64-pc-windows-gnupkg-config-lite%PATH%topkg-config-lite-0.28-1\bin%PKG_CONFIG_PATH%topkg-config-lite-0.28-1\libsI createdpkg-configwas working usingpkg-config -vlibusbfor Windows by clicking Downloads > Latest Windows binarieslibusb.pcfile in thePKG_CONFIG_PATHdirectory:Here's what
pkg-config --libs --cflags libusb-1.0spits 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.0I am using this example code based on what's in the
README.mdfile of this repository:Running
cargo runthen links just fine and runs the binary which subsequently fails with the3221225781exit code, which is0xC0000135, which meansSTATUS_DLL_NOT_FOUND.I suspect this is because I am using the
dlldirectory, not thestaticdirectory, but with that one, I just get linked errors.@dcuddeback would you be able to advise here?