From bf5b6cfe2b6c5d3ac118901f666290ba8c82ef8d Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Tue, 26 Dec 2023 13:01:47 +0800 Subject: [PATCH] chore(release): build openssl statically in manylinux2014 build (#1115) * chore(release): build libssl statically in manylinux2014 build * fix: add openssl to cargo-machete ignore --- .github/workflows/release.yml | 7 ++++--- Cargo.lock | 11 +++++++++++ crates/tabby/Cargo.toml | 11 +++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b39430ae..59779403a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,16 +35,17 @@ jobs: target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014 container: quay.io/pypa/manylinux2014_x86_64 + build_args: --features static-ssl - os: ubuntu-latest target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014-cuda117 container: sameli/manylinux2014_x86_64_cuda_11.7 - build_args: --features cuda + build_args: --features static-ssl --features cuda - os: ubuntu-latest target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014-cuda122 container: sameli/manylinux2014_x86_64_cuda_12.2 - build_args: --features cuda + build_args: --features static-ssl --features cuda - os: windows-latest target: x86_64-pc-windows-msvc binary: x86_64-windows-msvc @@ -65,7 +66,7 @@ jobs: target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014-rocm57 container: ghcr.io/cromefire/hipblas-manylinux/2014/5.7:latest - build_args: --features rocm + build_args: --features static-ssl --features rocm env: SCCACHE_GHA_ENABLED: true diff --git a/Cargo.lock b/Cargo.lock index 14459e3df..284b6176b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2382,6 +2382,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-src" +version = "300.2.1+3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fe476c29791a5ca0d1273c697e96085bbabbbea2ef7afd5617e78a4b40332d3" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.97" @@ -2390,6 +2399,7 @@ checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] @@ -3673,6 +3683,7 @@ dependencies = [ "llama-cpp-bindings", "minijinja", "nvml-wrapper", + "openssl", "opentelemetry", "opentelemetry-otlp", "regex", diff --git a/crates/tabby/Cargo.toml b/crates/tabby/Cargo.toml index d1e225d19..3be376173 100644 --- a/crates/tabby/Cargo.toml +++ b/crates/tabby/Cargo.toml @@ -9,6 +9,10 @@ ee = ["dep:tabby-webserver"] cuda = ["llama-cpp-bindings/cuda"] rocm = ["llama-cpp-bindings/rocm"] experimental-http = ["dep:http-api-bindings"] +# If compiling on a system without OpenSSL installed, or cross-compiling for a different +# architecture, enable this feature to compile OpenSSL as part of the build. +# See https://docs.rs/openssl/#vendored for more. +static-ssl = ['openssl/vendored'] [dependencies] tabby-common = { path = "../tabby-common" } @@ -52,6 +56,10 @@ thiserror.workspace = true chrono = "0.4.31" axum-prometheus = "0.4.0" +[dependencies.openssl] +optional = true +version = "*" + [dependencies.uuid] version = "1.3.3" features = [ @@ -68,3 +76,6 @@ assert-json-diff = "2.0.2" insta = { version = "1.34.0", features = ["yaml", "redactions"] } reqwest.workspace = true serde-jsonlines = "0.5.0" + +[package.metadata.cargo-machete] +ignored = ["openssl"] \ No newline at end of file