ptrace devblog
comments, questions: blog@ptrace.dev | GPG Key
Rust-Cross SSL missing error
28/01/2025

If you're cross compiling with Rust, you're possibly using Cross.

In some projects, you might encounter an error message regarding missing libssl.
For example:

Could not find directory of OpenSSL installation [...]

The (to me) cleanest solution is, to create a Cross.toml file in your project root dir, and declare the libssl installation for each target.

Example:

[target.x86_64-unknown-linux-gnu]
pre-build = [
    "apt update",
    "apt install libssl-dev -y"
]

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

I do not know where I found this solution. Somewhere deep in the web, buried between some dirty hacks. But this solved, at least, my problem.