I am building on Debian-12 targeting Debian-11

Friends

I cannot build, naively, on Debian-12 for Debian-11 as there is a conflict with the libssl libraries.

My programme wants V3 and the target, being Debian-11, has V1.1

(I can build it in a container running Debian-11)

I have experience targetting different architectures, but How can I target a different OS version?

You are mentioning containers. So why aren’t you using Docker to compile for your target-OS?

The libssl libraries are often a pain in the ass: Can't cross-compile project with OpenSSL

You’ll make your life easier by just using a VM or Docker.

The most reliable way is to use Debian 11 for the build, using a container or a VM.

If you need libssl newer than in Debian 11, then use the vendored feature of openssl crate.

Another option is to build for the MUSL target, which should make binaries that work on any Linux distribution (but you may need to make sure your C dependencies are linked statically).

1 Like

Do note that the allocator of musl is quite slow (especially for concurrent and parallel workloads), so if you go down this route you might want to use mimalloc or jemalloc to replace the default global allocator.

If you build for ARM64 you likely want to use mimalloc rather than jemalloc since modern ARM chips are breaking away from the traditional 4k page size, and jemalloc doesn't handle different page size between build and runtime at all.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.