From ded04c4e3b339463aedbe1652e079b648b2ccb32 Mon Sep 17 00:00:00 2001 From: nikita42 Date: Tue, 5 May 2026 02:29:13 +0300 Subject: [PATCH] fix(release): vendor OpenSSL for linux-musl and aarch64-linux cross builds The release workflow failed for x86_64-unknown-linux-musl and aarch64-unknown-linux-gnu targets because openssl-sys (pulled in transitively via native-tls / postgres-native-tls / mysql_async) could not locate a target-side OpenSSL during cross-compilation. Add an optional `vendored-tls` feature that activates `openssl/vendored`, making openssl-sys statically build OpenSSL from source via openssl-src. The feature unifies across the entire dep graph thanks to Cargo's feature unification, so all transitive openssl-sys consumers benefit. The release workflow now passes `--features vendored-tls` only for the two cross targets that need it; native-host targets keep the fast path. Set CC_ env so openssl-src picks the correct cross C compiler. Bumps version to 0.2.1 for re-release. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release.yml | 10 +++++++++- Cargo.lock | 13 ++++++++++++- Cargo.toml | 4 +++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 71894be..85eddd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,21 +18,27 @@ jobs: - target: x86_64-unknown-linux-gnu os: ubuntu-latest archive: tar.gz + cargo_features: "" - target: x86_64-unknown-linux-musl os: ubuntu-latest archive: tar.gz + cargo_features: "--features vendored-tls" - target: aarch64-unknown-linux-gnu os: ubuntu-latest archive: tar.gz + cargo_features: "--features vendored-tls" - target: x86_64-apple-darwin os: macos-latest archive: tar.gz + cargo_features: "" - target: aarch64-apple-darwin os: macos-latest archive: tar.gz + cargo_features: "" - target: x86_64-pc-windows-msvc os: windows-latest archive: zip + cargo_features: "" steps: - uses: actions/checkout@v6 @@ -56,9 +62,11 @@ jobs: run: sudo apt-get install -y musl-tools - name: Build - run: cargo build --release --locked --target ${{ matrix.target }} + run: cargo build --release --locked --target ${{ matrix.target }} ${{ matrix.cargo_features }} env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc + CC_x86_64_unknown_linux_musl: musl-gcc - name: Package (unix) if: matrix.archive == 'tar.gz' diff --git a/Cargo.lock b/Cargo.lock index 9a1425e..9c696ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -607,7 +607,7 @@ dependencies = [ [[package]] name = "dbdiff" -version = "0.2.0" +version = "0.2.1" dependencies = [ "assert_cmd", "clap", @@ -616,6 +616,7 @@ dependencies = [ "indicatif", "mysql_async", "native-tls", + "openssl", "postgres-native-tls", "predicates", "regex", @@ -1577,6 +1578,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" +[[package]] +name = "openssl-src" +version = "300.6.0+3.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8e8cbfd3a4a8c8f089147fd7aaa33cf8c7450c4d09f8f80698a0cf093abeff4" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.112" @@ -1585,6 +1595,7 @@ checksum = "57d55af3b3e226502be1526dfdba67ab0e9c96fc293004e79576b2b9edb0dbdb" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/Cargo.toml b/Cargo.toml index 30dd8b2..a5db987 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dbdiff" -version = "0.2.0" +version = "0.2.1" edition = "2021" rust-version = "1.75" authors = ["rekurt"] @@ -30,6 +30,7 @@ default = ["postgres", "mysql", "sqlite"] postgres = ["dep:tokio-postgres", "dep:postgres-native-tls", "dep:native-tls"] mysql = ["dep:mysql_async"] sqlite = ["dep:rusqlite"] +vendored-tls = ["dep:openssl"] [dependencies] clap = { version = "4", features = ["derive"] } @@ -39,6 +40,7 @@ tokio-postgres = { version = "0.7", optional = true } postgres-native-tls = { version = "0.5", optional = true } native-tls = { version = "0.2", optional = true } mysql_async = { version = "0.34", optional = true } +openssl = { version = "0.10", features = ["vendored"], optional = true } rusqlite = { version = "0.39", features = ["bundled"], optional = true } colored = "3" indicatif = "0.18"