[PR #76] [MERGED] Support other tls implementations besides openssl #228

Closed
opened 2026-02-27 20:23:52 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/76
Author: @marcelbuesing
Created: 2/5/2020
Status: Merged
Merged: 6/1/2020
Merged by: @ramsayleung

Base: masterHead: ease-cross-compilation


📝 Commits (2)

  • 7d8e475 Support other tls implementations besides openssl
  • 59c4ef9 Add CI step for cross compilation

📊 Changes

4 files changed (+72 additions, -4 deletions)

View changed files

📝 .github/workflows/ci.yml (+30 -0)
📝 Cargo.toml (+14 -2)
📝 src/lib.rs (+16 -1)
📝 tests/test_device.rs (+12 -1)

📄 Description

Goal is to make it easier to cross compile when using this crate.
Basically I feel a big pain point in cross compilation are always libraries such as libopenssl which have to be available for your target architecture. Rust native implementations make cross compilation a lot easier because you can pretty much just rely on cargo without having to worry about missing some particular library.

Before:

cargo build --release --target arm-unknown-linux-gnueabihf                                            
   Compiling openssl-sys v0.9.54
   Compiling futures-util v0.3.3
error: failed to run custom build command for `openssl-sys v0.9.54`

Caused by:
  process didn't exit successfully: `/home/abc/github-thirdparty/rspotify/target/release/build/openssl-sys-47ed6ba4b4c9b64b/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR
ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR
ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR
ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
run pkg_config fail: "Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu
$TARGET = arm-unknown-linux-gnueabihf
openssl-sys = 0.9.54

', /home/abc/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.54/build/find_normal.rs:150:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

After using rustls:

 cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features rustls-tls
   Compiling rspotify v0.8.0 (/home/abc/github-thirdparty/rspotify)
    Finished release [optimized] target(s) in 13.69s

After using openssl vendored (build from source):

cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features native-tls-vendored         
   Compiling rspotify v0.8.0 (/home/abc/github-thirdparty/rspotify)
    Finished release [optimized] target(s) in 13.85s

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ramsayleung/rspotify/pull/76 **Author:** [@marcelbuesing](https://github.com/marcelbuesing) **Created:** 2/5/2020 **Status:** ✅ Merged **Merged:** 6/1/2020 **Merged by:** [@ramsayleung](https://github.com/ramsayleung) **Base:** `master` ← **Head:** `ease-cross-compilation` --- ### 📝 Commits (2) - [`7d8e475`](https://github.com/ramsayleung/rspotify/commit/7d8e475b38371fb806432ad4922c5f6483d3270e) Support other tls implementations besides openssl - [`59c4ef9`](https://github.com/ramsayleung/rspotify/commit/59c4ef9163c4ff1372cc9acd235d117e23f3aaf5) Add CI step for cross compilation ### 📊 Changes **4 files changed** (+72 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+30 -0) 📝 `Cargo.toml` (+14 -2) 📝 `src/lib.rs` (+16 -1) 📝 `tests/test_device.rs` (+12 -1) </details> ### 📄 Description Goal is to make it easier to cross compile when using this crate. Basically I feel a big pain point in cross compilation are always libraries such as libopenssl which have to be available for your target architecture. Rust native implementations make cross compilation a lot easier because you can pretty much just rely on cargo without having to worry about missing some particular library. Before: ``` cargo build --release --target arm-unknown-linux-gnueabihf Compiling openssl-sys v0.9.54 Compiling futures-util v0.3.3 error: failed to run custom build command for `openssl-sys v0.9.54` Caused by: process didn't exit successfully: `/home/abc/github-thirdparty/rspotify/target/release/build/openssl-sys-47ed6ba4b4c9b64b/build-script-main` (exit code: 101) --- stdout cargo:rustc-cfg=const_fn cargo:rerun-if-env-changed=ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR ARM_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_DIR OPENSSL_DIR unset run pkg_config fail: "Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override" --- stderr thread 'main' panicked at ' Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. Make sure you also have the development packages of openssl installed. For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora. If you're in a situation where you think the directory *should* be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message. $HOST = x86_64-unknown-linux-gnu $TARGET = arm-unknown-linux-gnueabihf openssl-sys = 0.9.54 ', /home/abc/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.54/build/find_normal.rs:150:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. warning: build failed, waiting for other jobs to finish... error: build failed ``` After using [rustls](https://github.com/ctz/rustls): ``` cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features rustls-tls Compiling rspotify v0.8.0 (/home/abc/github-thirdparty/rspotify) Finished release [optimized] target(s) in 13.69s ``` After using openssl vendored (build from source): ``` cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features native-tls-vendored Compiling rspotify v0.8.0 (/home/abc/github-thirdparty/rspotify) Finished release [optimized] target(s) in 13.85s ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:23:52 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#228
No description provided.