a1ien / rusb

A safe Rust wrapper for libusb.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

windows build failed for me until manual vcpkg install

anandijain opened this issue · comments

i know the readme says that libusb will be downloaded and built. for my machine (win11), i needed to run vcpkg install libusb:x64-windows-static-md then the examples ran great.

here is the build failure i got trying to run the list_devices example before manually installing the correct libusb (vcpkg install libusb didn't work only the static one got it running)

thank you for the great library! this issue is very minor

PS C:\Users\anand\.rust\rusb> c r --release --example list_devices
   Compiling proc-macro2 v1.0.81
   Compiling siphasher v0.3.11
   Compiling rand_core v0.6.4
   Compiling vcpkg v0.2.15
   Compiling pkg-config v0.3.30
   Compiling unicode-ident v1.0.12
   Compiling cc v1.0.95
   Compiling libc v0.2.153
   Compiling memchr v2.7.2
   Compiling minimal-lexical v0.2.1
   Compiling rand v0.8.5                                                                            
   Compiling phf_shared v0.11.2                                                                     
   Compiling regex-syntax v0.8.3                                                                    
   Compiling rusb v0.9.4 (C:\Users\anand\.rust\rusb)                                                
   Compiling phf v0.11.2                                                                            
   Compiling nom v7.1.3                                                                             
   Compiling aho-corasick v1.1.3                                                                    
   Compiling phf_generator v0.11.2                                                                  
   Compiling phf_codegen v0.11.2                                                                    
   Compiling quote v1.0.36                                                                          
   Compiling libusb1-sys v0.7.0 (C:\Users\anand\.rust\rusb\libusb1-sys)                             
error: failed to run custom build command for `libusb1-sys v0.7.0 (C:\Users\anand\.rust\rusb\libusb1-sys)`

Caused by:
  process didn't exit successfully: `C:\Users\anand\.rust\rusb\target\release\build\libusb1-sys-bdf8672d618b571f\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBUSB_STATIC
  cargo:rerun-if-env-changed=LIBUSB_1.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBUSB_1.0_STATIC
  cargo:rerun-if-env-changed=LIBUSB_1.0_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  Can't find libusb pkg: LibNotFound("package libusb is not installed for vcpkg triplet x64-windows-static-md")
  cargo:vendored=1
  cargo:static=1

  --- stderr
  thread 'main' panicked at libusb1-sys\build.rs:110:6:
  called `Result::unwrap()` on an `Err` value: Os { code: 3, kind: NotFound, message: "The system cannot find the path specified." }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
PS C:\Users\anand\.rust\rusb>

Hmm.. this strange because in CI everything is ok https://github.com/a1ien/rusb/actions/runs/8860915455/job/24332216760
Can you try run
cargo run --example ffi_info --features=vendored -vv
and you can also try without --features=vendored
cargo run --example ffi_info -vv

Oh. you probably forgot to get git sub-modules
git submodule update --init

thanks a lot!