alexcrichton / ssh2-rs

Rust bindings for libssh2
https://docs.rs/ssh2
Apache License 2.0
491 stars 148 forks source link

does not build on an esp32 #317

Open keredson opened 6 months ago

keredson commented 6 months ago

this does not build on the esp32 microcontroller. example:

$ cargo install espup
$ espup install
$ . $HOME/export-esp.sh
$ cargo generate esp-rs/esp-idf-template
⚠️   Favorite `esp-rs/esp-idf-template` not found in config, using it as a git repository: https://github.com/esp-rs/esp-idf-template.git
✔ 🤷   Which template should be expanded? · cargo
🤷   Project Name: test-ssh2
🔧   Destination: /tmp/test-ssh2 ...
🔧   project-name: test-ssh2 ...
🔧   Generating template ...
✔ 🤷   Which MCU to target? · esp32
✔ 🤷   Configure advanced template options? · true
✔ 🤷   ESP-IDF version (master = UNSTABLE) · v5.1
✔ 🤷   Enable STD support? · true
✔ 🤷   Configure project to use Dev Containers (VS Code and GitHub Codespaces)? · false
✔ 🤷   Configure project to support Wokwi simulation with Wokwi VS Code extension? · false
✔ 🤷   Add CI files for GitHub Action? · false
🔧   Moving generated files into: `/tmp/test-ssh2`...
🔧   Initializing a fresh Git repository
✨   Done! New project created /tmp/test-ssh2
$ cargo build
   Compiling test-ssh2 v0.1.0 (/tmp/test-ssh2)
    Finished dev [optimized + debuginfo] target(s) in 2.77s

but when you add ssh2:

$ cargo add ssh2 -F vendored-openssl
    Updating crates.io index
      Adding ssh2 v0.9.4 to dependencies.
             Features:
             + vendored-openssl
             - openssl-on-win32

you get:

$ cargo build
[...]
error: failed to run custom build command for `openssl-sys v0.9.102`

Caused by:
  process didn't exit successfully: `/tmp/test-ssh2/target/debug/build/openssl-sys-682491a0cf30e5a8/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=XTENSA_ESP32_ESPIDF_OPENSSL_NO_VENDOR
  XTENSA_ESP32_ESPIDF_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset

  --- stderr
  thread 'main' panicked at /home/derek/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.2.3+3.2.1/src/lib.rs:366:18:
  don't know how to configure OpenSSL for xtensa-esp32-espidf
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
keredson commented 6 months ago

interesting. if i only add openssl-sys = "0.9.35" directly and build with PKG_CONFIG_ALLOW_CROSS=1 cargo build, it builds successfully.