cross icon indicating copy to clipboard operation
cross copied to clipboard

Static linking `riscv64gc-unknown-linux-musl` +nightly target breaks SSL/TLS

Open Azathothas opened this issue 6 months ago • 0 comments

Checklist

Describe your issue

Hi, recently, we used cross to compile ~ 10,000 crates. The experiment was mostly a success, however, all crates linked with riscv64gc-unknown-linux-musl are broken. The ones that use reqwest, they error out with:

Image

What target(s) are you cross-compiling for?

riscv64gc-unknown-linux-musl

Which operating system is the host (e.g computer cross is on) running?

  • [ ] macOS
  • [ ] Windows
  • [x] Linux / BSD
  • [ ] other OS (specify in description)

What architecture is the host?

  • [x] x86_64 / AMD64
  • [ ] arm32
  • [ ] arm64 (including Mac M1)

What container engine is cross using?

  • [x] docker
  • [ ] podman
  • [ ] other container engine (specify in description)

cross version

cross 0.2.5 (51f46f2 2025-05-24)

Example

To reproduce, take any crate that use reqwest, like soar:

#Set RUSTFLAGS:
export RUSTFLAGS="-C target-feature=+crt-static"

#Build
cross +nightly build --release --locked --target "riscv64gc-unknown-linux-musl" --jobs="$(($(nproc)+1))" --verbose

#Run it on real riscv64 or qemu will also replicate it
#Binary runs normally, until it has to do network requests
$ ./soar sync
[ERROR] HTTP request error: reqwest::Error { kind: Request, source: hyper_util::client::legacy::Error(SendRequest, hyper::Error(Io, Custom { kind: InvalidData, error: "received fatal alert: BadRecordMac" })) }

Additional information / notes

riscv64gc-unknown-linux-gnu is not affected. Only +nightly is affected, stable is not affected.

Azathothas avatar Jun 29 '25 04:06 Azathothas