solokeys / solo2-cli

Solo 2 library and CLI in Rust
https://docs.rs/solo2
Apache License 2.0
173 stars 31 forks source link

fail to compile (dependencies?) #69

Closed churchthecat closed 2 years ago

churchthecat commented 2 years ago

command $ cargo install solo2 results in

....... Compiling num-bigint-dig v0.7.0 Compiling uriparse v0.6.4 error: failed to run custom build command forpcsc-sys v1.2.0`

Caused by: process didn't exit successfully: /tmp/cargo-installSSHJ9R/release/build/pcsc-sys-88cd1d3ac0c201e1/build-script-build (exit status: 101) --- stdout cargo:rerun-if-env-changed=LIBPCSCLITE_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=LIBPCSCLITE_STATIC cargo:rerun-if-env-changed=LIBPCSCLITE_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-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu 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-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu 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-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

--- stderr thread 'main' panicked at 'Could not find a PCSC library. For the target OS linux, I tried to use pkg-config to find libpcsclite. Do you have pkg-config and libpcsclite configured for this target?: "pkg-config" "--libs" "--cflags" "libpcsclite" "libpcsclite >= 1" did not exit successfully: exit status: 1 error: could not find system library 'libpcsclite' required by the 'pcsc-sys' crate

--- stderr Package libpcsclite was not found in the pkg-config search path. Perhaps you should add the directory containing libpcsclite.pc' to the PKG_CONFIG_PATH environment variable No package 'libpcsclite' found Package libpcsclite was not found in the pkg-config search path. Perhaps you should add the directory containinglibpcsclite.pc' to the PKG_CONFIG_PATH environment variable No package 'libpcsclite' found ', /home/tcc/.cargo/registry/src/github.com-1ecc6299db9ec823/pcsc-sys-1.2.0/build.rs:30:22 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: failed to compile solo2 v0.1.1, intermediate artifacts can be found at /tmp/cargo-installSSHJ9R `

nickray commented 2 years ago

It's telling you that libpcsclite is missing, so please install it. Otherwise, use a pre-built version.

rugk commented 1 year ago

I followed https://solokeys.com/pages/firmware-update-on-a-mac, but on Linux (given no Linux guide was there), and it told me to do this. Also it did not tell me where/that there would be pre-built versions.

Fedora 36

rugk commented 1 year ago

For Fedora 36 I have installed the libs via dnf install pcsc-lite-libs, but it still fails:

$ cargo install solo2         
    Updating crates.io index
  Installing solo2 v0.2.1
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.47
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.5
   Compiling libc v0.2.135
   Compiling syn v1.0.102
   Compiling version_check v0.9.4
   Compiling cfg-if v1.0.0
   Compiling cc v1.0.73
   Compiling typenum v1.15.0
   Compiling libm v0.2.5
   Compiling spin v0.5.2
   Compiling memchr v2.5.0
   Compiling log v0.4.17
   Compiling subtle v2.4.1
   Compiling heck v0.4.0
   Compiling pkg-config v0.3.25
   Compiling once_cell v1.15.0
   Compiling unicode-xid v0.2.4
   Compiling serde_derive v1.0.145
   Compiling os_str_bytes v6.3.0
   Compiling hashbrown v0.12.3
   Compiling untrusted v0.7.1
   Compiling serde v1.0.145
   Compiling textwrap v0.15.1
   Compiling termcolor v1.1.3
   Compiling tinyvec_macros v0.1.0
   Compiling semver v1.0.14
   Compiling strsim v0.10.0
   Compiling bitflags v1.3.2
   Compiling const-oid v0.6.2
   Compiling minimal-lexical v0.2.1
   Compiling percent-encoding v2.2.0
   Compiling byteorder v1.4.3
   Compiling ppv-lite86 v0.2.16
   Compiling delog v0.1.6
   Compiling unicode-bidi v0.3.8
   Compiling regex-syntax v0.6.27
   Compiling lazy_static v1.4.0
   Compiling base64ct v1.1.1
   Compiling scopeguard v1.1.0
   Compiling crc32fast v1.3.2
   Compiling ryu v1.0.11
   Compiling oid-registry v0.2.0
   Compiling base64 v0.13.0
   Compiling unicode-width v0.1.10
   Compiling anyhow v1.0.65
   Compiling iana-time-zone v0.1.51
   Compiling cpufeatures v0.2.5
   Compiling serde_json v1.0.86
   Compiling thiserror v1.0.37
   Compiling quick-error v1.2.3
   Compiling itoa v1.0.4
   Compiling fnv v1.0.7
   Compiling smallvec v1.10.0
   Compiling rustls v0.20.7
   Compiling adler v1.0.2
   Compiling chunked_transfer v1.4.0
   Compiling linked-hash-map v0.5.6
   Compiling remove_dir_all v0.5.3
   Compiling stable_deref_trait v1.2.0
   Compiling number_prefix v0.4.0
   Compiling data-encoding v2.3.2
   Compiling ascii v1.1.0
   Compiling fastrand v1.8.0
   Compiling opaque-debug v0.3.0
   Compiling signature v1.6.4
   Compiling uuid v0.8.2
   Compiling hex v0.4.3
   Compiling webbrowser v0.5.5
   Compiling hex-literal v0.3.4
   Compiling autocfg v0.1.8
   Compiling tinyvec v1.6.0
   Compiling generic-array v0.14.6
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling clap_lex v0.2.4
   Compiling num-integer v0.1.45
   Compiling num-traits v0.2.15
   Compiling indexmap v1.9.1
   Compiling num-bigint v0.4.3
   Compiling num-bigint v0.2.6
   Compiling num-iter v0.1.43
   Compiling lock_api v0.4.9
   Compiling form_urlencoded v1.1.0
   Compiling hash32 v0.2.1
   Compiling pem-rfc7468 v0.2.4
   Compiling pcsc-sys v1.2.0
   Compiling humantime v1.3.0
   Compiling pem v1.1.0
   Compiling miniz_oxide v0.5.4
   Compiling yaml-rust v0.4.5
   Compiling uriparse v0.6.4
   Compiling num-bigint-dig v0.7.0
   Compiling ring v0.16.20
   Compiling hidapi v1.4.2
   Compiling libloading v0.5.2
error: failed to run custom build command for `pcsc-sys v1.2.0`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installKLUkWP/release/build/pcsc-sys-ffa8f7c09a0dbdef/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBPCSCLITE_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBPCSCLITE_STATIC
  cargo:rerun-if-env-changed=LIBPCSCLITE_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-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  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-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  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-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'Could not find a PCSC library.
  For the target OS `linux`, I tried to use pkg-config to find libpcsclite.
  Do you have pkg-config and libpcsclite configured for this target?: `"pkg-config" "--libs" "--cflags" "libpcsclite" "libpcsclite >= 1"` did not exit successfully: exit status: 1
  error: could not find system library 'libpcsclite' required by the 'pcsc-sys' crate

  --- stderr
  Package libpcsclite was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libpcsclite.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'libpcsclite', required by 'virtual:world', not found
  Package 'libpcsclite', required by 'virtual:world', not found
  ', /var/home/rugk/.cargo/registry/src/github.com-1ecc6299db9ec823/pcsc-sys-1.2.0/build.rs:30:22
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `solo2 v0.2.1`, intermediate artifacts can be found at `/tmp/cargo-installKLUkWP`
dnf info pcsc-lite-libs
Last metadata expiration check: 0:09:58 ago on Wed Oct 19 22:34:15 2022.
Installed Packages
Name         : pcsc-lite-libs
Version      : 1.9.8
Release      : 1.fc36
Architecture : x86_64
Size         : 45 k
Source       : pcsc-lite-1.9.8-1.fc36.src.rpm
Repository   : @System
From repo    : updates
Summary      : PC/SC Lite libraries
URL          : https://pcsclite.apdu.fr/
License      : BSD
Description  : PC/SC Lite libraries.
rugk commented 1 year ago

That is the correct package, so what is wrong here?

rugk commented 1 year ago

Ahhh, I also needed pcsc-lite-devel

Up to the next error:

$ cargo install solo2                             
    Updating crates.io index
  Installing solo2 v0.2.1
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.47
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.5
   Compiling libc v0.2.135
   Compiling syn v1.0.102
   Compiling version_check v0.9.4
   Compiling cfg-if v1.0.0
   Compiling cc v1.0.73
   Compiling typenum v1.15.0
   Compiling libm v0.2.5
   Compiling spin v0.5.2
   Compiling memchr v2.5.0
   Compiling log v0.4.17
   Compiling subtle v2.4.1
   Compiling heck v0.4.0
   Compiling pkg-config v0.3.25
   Compiling once_cell v1.15.0
   Compiling serde_derive v1.0.145
   Compiling unicode-xid v0.2.4
   Compiling untrusted v0.7.1
   Compiling os_str_bytes v6.3.0
   Compiling serde v1.0.145
   Compiling hashbrown v0.12.3
   Compiling textwrap v0.15.1
   Compiling strsim v0.10.0
   Compiling tinyvec_macros v0.1.0
   Compiling bitflags v1.3.2
   Compiling semver v1.0.14
   Compiling termcolor v1.1.3
   Compiling byteorder v1.4.3
   Compiling minimal-lexical v0.2.1
   Compiling percent-encoding v2.2.0
   Compiling const-oid v0.6.2
   Compiling ppv-lite86 v0.2.16
   Compiling lazy_static v1.4.0
   Compiling unicode-bidi v0.3.8
   Compiling regex-syntax v0.6.27
   Compiling delog v0.1.6
   Compiling base64ct v1.1.1
   Compiling thiserror v1.0.37
   Compiling serde_json v1.0.86
   Compiling anyhow v1.0.65
   Compiling scopeguard v1.1.0
   Compiling iana-time-zone v0.1.51
   Compiling cpufeatures v0.2.5
   Compiling unicode-width v0.1.10
   Compiling base64 v0.13.0
   Compiling crc32fast v1.3.2
   Compiling oid-registry v0.2.0
   Compiling ryu v1.0.11
   Compiling adler v1.0.2
   Compiling linked-hash-map v0.5.6
   Compiling quick-error v1.2.3
   Compiling itoa v1.0.4
   Compiling smallvec v1.10.0
   Compiling rustls v0.20.7
   Compiling fnv v1.0.7
   Compiling chunked_transfer v1.4.0
   Compiling opaque-debug v0.3.0
   Compiling remove_dir_all v0.5.3
   Compiling ascii v1.1.0
   Compiling number_prefix v0.4.0
   Compiling stable_deref_trait v1.2.0
   Compiling fastrand v1.8.0
   Compiling data-encoding v2.3.2
   Compiling hex v0.4.3
   Compiling signature v1.6.4
   Compiling uuid v0.8.2
   Compiling hex-literal v0.3.4
   Compiling webbrowser v0.5.5
   Compiling autocfg v0.1.8
   Compiling tinyvec v1.6.0
   Compiling generic-array v0.14.6
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling num-integer v0.1.45
   Compiling num-traits v0.2.15
   Compiling indexmap v1.9.1
   Compiling num-bigint v0.4.3
   Compiling lock_api v0.4.9
   Compiling num-bigint v0.2.6
   Compiling num-iter v0.1.43
   Compiling clap_lex v0.2.4
   Compiling form_urlencoded v1.1.0
   Compiling hash32 v0.2.1
   Compiling pem-rfc7468 v0.2.4
   Compiling pcsc-sys v1.2.0
   Compiling miniz_oxide v0.5.4
   Compiling pem v1.1.0
   Compiling humantime v1.3.0
   Compiling yaml-rust v0.4.5
   Compiling uriparse v0.6.4
   Compiling num-bigint-dig v0.7.0
   Compiling ring v0.16.20
   Compiling hidapi v1.4.2
   Compiling libloading v0.5.2
   Compiling unicode-normalization v0.1.22
   Compiling aho-corasick v0.7.19
   Compiling nom v7.1.1
error: failed to run custom build command for `hidapi v1.4.2`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installNH89tq/release/build/hidapi-8976aa94458caadc/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBUDEV_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=LIBUDEV_STATIC
  cargo:rerun-if-env-changed=LIBUDEV_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-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  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-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  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-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'Unable to find libudev: `"pkg-config" "--libs" "--cflags" "libudev"` did not exit successfully: exit status: 1
  error: could not find system library 'libudev' required by the 'hidapi' crate

  --- stderr
  Package libudev was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libudev.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'libudev', required by 'virtual:world', not found
  ', /var/home/rugk/.cargo/registry/src/github.com-1ecc6299db9ec823/hidapi-1.4.2/build.rs:57:54
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `solo2 v0.2.1`, intermediate artifacts can be found at `/tmp/cargo-installNH89tq`
rugk commented 1 year ago

Tried dnf provides (only also told me to install systemd-libs, which did not help, but I found this:

$ sudo dnf search libudev
Last metadata expiration check: 0:27:50 ago on Wed Oct 19 22:34:15 2022.
=========================================== Name & Summary Matched: libudev ============================================
rust-libudev+default-devel.noarch : Rust wrapper for libudev
rust-libudev-devel.noarch : Rust wrapper for libudev
rust-libudev-sys+default-devel.noarch : FFI bindings to libudev
rust-libudev-sys-devel.noarch : FFI bindings to libudev
=============================================== Summary Matched: libudev ===============================================
libgudev.i686 : GObject-based wrapper library for libudev
libgudev.x86_64 : GObject-based wrapper library for libudev
python3-pyudev.noarch : A libudev binding

Clearly this is the lib, which is anyway being installed, but the dependencies then told me which lib I can finally install:

sudo dnf install rust-libudev-devel                  
Last metadata expiration check: 0:28:58 ago on Wed Oct 19 22:34:15 2022.
Dependencies resolved.
========================================================================================================================
 Package                                     Architecture        Version                     Repository            Size
========================================================================================================================
Installing:
 rust-libudev-devel                          noarch              0.2.0-13.fc36               fedora                18 k
Installing dependencies:
 rust-libc+default-devel                     noarch              0.2.134-1.fc36              updates               11 k
 rust-libc+std-devel                         noarch              0.2.134-1.fc36              updates               11 k
 rust-libc-devel                             noarch              0.2.134-1.fc36              updates              321 k
 rust-libudev-sys+default-devel              noarch              0.1.4-13.fc36               fedora               7.6 k
 rust-libudev-sys-devel                      noarch              0.1.4-13.fc36               fedora                15 k
 rust-pkg-config+default-devel               noarch              0.3.25-1.fc36               updates              8.2 k
 rust-pkg-config-devel                       noarch              0.3.25-1.fc36               updates               25 k
 systemd-devel                               x86_64              250.8-1.fc36                updates              451 k

Transaction Summary
========================================================================================================================

The systemd-devel is clearly what I am missing…

rugk commented 1 year ago

That worked, so in essence, this is what you need to install: sudo dnf install pcsc-lite-devel systemd-devel

Well… okay.