fix: add Cross.toml to fix OpenSSL cross-compilation failures#33
Conversation
Problem: Release workflow v0.1.1 failed on all cross-compilation targets with error: failed to run custom build command for openssl-sys v0.9.111 Could not find directory of OpenSSL installation Root cause: reqwest dependency uses native-tls feature which requires openssl-sys. Cross-compilation Docker containers don't include OpenSSL development headers for target architectures by default. Solution: Add Cross.toml configuration file with pre-build hook that: 1. Adds target architecture to dpkg 2. Updates apt package lists 3. Installs libssl-dev and pkg-config for the target architecture This allows openssl-sys build script to locate headers during cross- compilation. References: - Failed run: https://github.com/MostroP2P/mostrix/actions/runs/23092367046 - Cross docs: https://github.com/cross-rs/cross/wiki/Configuration - Similar fix in cargo-chef, diesel_cli, and other Rust cross-compiled tools Alternative considered: Switch reqwest to rustls-tls feature to avoid OpenSSL entirely. Rejected because it would change TLS behavior and require thorough testing of HTTPS connections.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a Cross.toml configuration file to enable cross-compilation targeting multiple architectures. The configuration includes a pre-build hook that prepares the build environment by adding Debian architectures, updating package lists, and installing OpenSSL development libraries and pkg-config. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes the OpenSSL cross-compilation failures that caused the v0.1.1 release workflow to fail on all target architectures.
Problem
Release workflow run failed: https://github.com/MostroP2P/mostrix/actions/runs/23092367046
All 5 cross-compilation targets failed with:
Root cause:
reqwestusesnative-tlsfeature → depends onopenssl-sys→ needs OpenSSL dev headers for target architecture → cross-compilation containers don't include these by default.Solution
Add
Cross.tomlconfiguration file with pre-build hook:This installs OpenSSL development headers for the target architecture before compilation, allowing
openssl-sysbuild script to locate them.Validation
cargo fmt— no changescargo clippy --all-targets --all-features -- -D warnings— passescargo test— 10 passed, 0 failedNext step: After merge, re-trigger release workflow to verify cross-compilation succeeds.
Alternative Considered
Switch to
rustls-tls:Pros:
Cons:
Decision: Use
Cross.tomlfix for now (minimal risk). Considerrustls-tlsmigration in a future PR with proper testing.References
cargo-chef,diesel_cli,tokio-postgresSummary by CodeRabbit
Release Notes