On Mon, Nov 07, 2022 at 01:47:28AM +0200, flipchan wrote: > Hey everyone, > > I have a "building instance" that cross compiles a rust code repository to > darwin, linux and some other platforms. I want to add support for compiling > rust code to openbsd 7.2. However, Openbsd does not have an official rust > toolchain. List of supported systems can be found here: > https://doc.rust-lang.org/nightly/rustc/platform-support.html > > > Does anyone have a rust-toolchain work around for compiling rust code on a > linux box to be able to produce a binary executable for a amd64 openbsd 7.2 > server?
Rust toolchain is built natively on all supported platforms (amd64, i386, arm64, sparc64, powerpc64, riscv64). In order to cross-compile it from Linux, you first need C/C++ crosscompiler to target OpenBSD. Most of the architectures (but not all) are based on LLVM toolchain (clang, libc++, libc++abiā¦), and most of the patches to properly support OpenBSD are upstreamed. So I advice you to first try to cross-compile simple C and C++ programs from Linux to OpenBSD to ensure that your C toolchain is working. You will need standard libraries and objects from https://cdn.openbsd.org/pub/OpenBSD/7.2/ (at least base72.tgz and comp72.tgz) Once done, you should be able to cross-compile Rust using standard Rust tools. See https://doc.rust-lang.org/nightly/rustc/platform-support/openbsd.html As reminder, OpenBSD versions are major version for each release: 7.1 and 7.2 are both major versions (with potential breaking changes between versions). Do not assume that a binary targeting 7.2 will be able to run on 7.3. OpenBSD isn't like Linux. Thanks. -- Sebastien Marie