cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.79k stars 379 forks source link

openssl dynamic linking from Cross.toml needs at runtime `libssl1.0.0` which doesn't exist anymore #1567

Open frederikhors opened 1 month ago

frederikhors commented 1 month ago

In my project I need to use openssl not for the HTTP part of my app but because I need to decode a PKCS7 file.

I added to my Cargo.toml:

openssl = { version = "0.10.66", default-features = false }

and to Cross.toml:

[target.aarch64-unknown-linux-gnu]
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH",
]

When I launch cross it builds but when the --release executable runs on Debian 12 machine with openssl installed the error is:

error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory

Why is it binded to libssl.so.1.0.0 and not to latest versions?

The openssl installed on the machine is:

openssl version -a
OpenSSL 3.0.14 4 Jun 2024 (Library: OpenSSL 3.0.14 4 Jun 2024)
built on: Sun Sep  1 14:59:10 2024 UTC
platform: debian-arm64
options:  bn(64,64)
compiler: gcc -fPIC -pthread -Wa,--noexecstack -Wall -fzero-call-used-regs=used-gpr -DOPENSSL_TLS_SECURITY_LEVEL=2 -Wa,--noexecstack -g -O2 -ffile-prefix-map=/build/reproducible-path/openssl-3.0.14=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
OPENSSLDIR: "/usr/lib/ssl"
ENGINESDIR: "/usr/lib/aarch64-linux-gnu/engines-3"
MODULESDIR: "/usr/lib/aarch64-linux-gnu/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_armcap=0xbd

If I use ldd I get this:

ldd executable
    linux-vdso.so.1 (0x0000ffffb51f0000)
    libssl.so.1.0.0 => not found
    libcrypto.so.1.0.0 => not found
    libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffb3fe0000)
    libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffb3fb0000)
    libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffffb3f10000)
    libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffffb3ee0000)
    libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffb3d30000)
    /lib/ld-linux-aarch64.so.1 (0x0000ffffb51b3000)

Thank you all.

thomas725 commented 1 month ago

Having the same problem, target system has libssl1.1 & libssl3 available, but the cross build link's against 1.0.0.

I believe one way to workaround this would be to use a container that has one of those instead of the one used by default.

frederikhors commented 1 month ago

Yeah. They are going to upgrade the Docker images soon. I hope.

Emilgardis commented 1 month ago

Yes, this is planned!

frederikhors commented 1 month ago

Ok. I think we can close this.

Emilgardis commented 1 month ago

Reopening since it's not fixed yet

thomas725 commented 1 month ago

Yeah. They are going to upgrade the Docker images soon. I hope.

Who are "they"? Is there an upstream project responsible for that? Where can I find the currently used docker container's definition?

Emilgardis commented 1 month ago

The definitions live here: https://github.com/cross-rs/cross/tree/main/docker

"They" would be the maintainers of cross-rs, so for example me :)

I've made a remark here about upgrading https://redirect.github.com/cross-rs/cross/pull/973#issuecomment-2397886693