-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linking on Windows #20
Comments
I got it working on windows with a .cargo/config build script override and the dll from here: [target.x86_64-pc-windows-msvc.'usb-1.0']
rustc-link-search = ['D:\libs\64bit']
rustc-link-lib = ['libusb-1.0'] |
@TomasHubelbauer When I built this library (March 2015), rustup didn't exist, so I've not tested with the toolchains provided by rustup. The documented way to install Rust on Windows at that time was to use MSYS2. I documented the steps that worked for me in dcuddeback/libusb-sys#4. There's also a PR for libusb-sys that borrows a build strategy from rust-openssl, which is supposed to work with MSVC as well: dcuddeback/libusb-sys#5. You may want to give that a try. I haven't had time to test it myself. I'm not as comfortable on Windows as I am on Unix, so I could use help solving Windows build issues. If you happen to try dcuddeback/libusb-sys#5, I'd appreciate some feedback on whether or not it solves your issue. |
@TomasHubelbauer Thank you for your detailed report. This report helped me get my instance compiling with libusb. Specifically the pkg-config portion helped me the most. |
I just succesfully built a windows binary using dcuddeback/libusb-sys#5.
|
@TomasHubelbauer Thank you for your detailed report!! the best libusb/windows docs I've found! Thank you! |
@TomasHubelbauer, use the static lib, and modify the last line of libusb.pc to:
There is my libusb.pc:
libdir has only one file that is a copy of |
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-gnu
pkg-config-lite
%PATH%
topkg-config-lite-0.28-1\bin
%PKG_CONFIG_PATH%
topkg-config-lite-0.28-1\libs
I createdpkg-config
was working usingpkg-config -v
libusb
for Windows by clicking Downloads > Latest Windows binarieslibusb.pc
file in thePKG_CONFIG_PATH
directory: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:Running
cargo run
then links just fine and runs the binary which subsequently fails with the3221225781
exit code, which is0xC0000135
, which meansSTATUS_DLL_NOT_FOUND
.I suspect this is because I am using the
dll
directory, not thestatic
directory, but with that one, I just get linked errors.@dcuddeback would you be able to advise here?
The text was updated successfully, but these errors were encountered: