These steps are designed for cross-compilation from an Ubuntu 24 linux distro, using a Windows 11 Pro VM and hardware running macOS Sonoma on an M3 CPU.
To install a target:
rustup target add $TARGET
rustup toolchain install stable-$TARGET
- x86_64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
Debian packaging requires:
sudo apt install \
pkg-config \
build-essential \
crossbuild-essential-arm64 \
crossbuild-essential-armhf
Snap packaging requires:
sudo snap install snapcraft --classic
Cross-compiling requires:
cargo install cross
Debian packaging requires:
cargo install cargo-deb
RPM packaging requires:
cargo install cargo-generate-rpm
# for each rustup TARGET ...
cross --release --target=$TARGET
Requires the cross-build-essential-
packages
# for each linux rust TARGET, after compiling ...
cargo deb --target=$TARGET --no-build
From the project root:
snapcraft
# for each linux rust TARGET, after compiling ...
cargo generate-rpm --target=$TARGET
- Install a Windows 11 VM. Update it.
- Install OpenSSH Server feature:
- Reference: https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
- Settings > System > Features > View Features > Add Feature > "OpenSSH Server"
- Services > "OpenSSH Server" > Properties > Start: Automatically
- Configure Powershell as the default OpenSSH shell:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
- Configure OpenSSH for pubkey authentication: Microsoft: Key-based authentication in OpenSSH for Windows
- Install rustup.
- After installing VS 2022, manually install the C++ Desktop Development component to it.
- Install WiX v3
- Install cargo-wx:
cargo install cargo-wix
cargo build --release
cargo wix