Crates.io | crit |
lib.rs | crit |
version | 0.0.8 |
source | src |
created_at | 2023-03-30 19:09:57.276085 |
updated_at | 2024-01-15 04:37:16.395129 |
description | Rust cross-compiler |
homepage | https://github.com/mcandre/crit |
repository | |
max_upload_size | |
id | 825361 |
size | 41,028 |
.__ __
___________|__|/ |_
_/ ___\_ __ \ \ __\
\ \___| | \/ || |
\___ >__| |__||__|
\/
crit
compiles Rust application ports for many different target platforms. This effort is based on conventional Rust tooling, including cross
, cargo
, and the amazing rustc
compiler.
$ cd example
$ crit
$ ls .crit/bin
aarch64-apple-darwin
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
...
By default, crit builds in release mode (-- -r
).
See crit -h
for more options.
https://docs.rs/crit/latest/crit/
https://github.com/mcandre/crit/releases
$ cargo install --force --path .
BSD-2-Clause
DOCKER_DEFAULT_PLATFORM
= linux/amd64
environment variableasdf reshim
after each Rust application binary installation)tar is a portable archiver suitable for creating *.tgz
tarball archives. Users can then download the tarball and extract the executable relevant to their platform. Tarballs are especially well suited for use in Docker containers, as the tar command is more likely to be installed than unzip.
Note that non-UNIX file systems may not preserve crucial chmod acl bits during port generation. This can corrupt downstream artifacts, such as compressed archives and installation procedures.
For more details on developing crit itself, see DEVELOPMENT.md.
Check that your project is able to build with conventional cross
or cargo
commands against a single target. A project that does not compile against a single target, will naturally have difficulty when attempting to cross-compile for multiple targets.
Note that Rust introduces new, under-supported targets all the time. We try to keep up, but sometimes we miss a few of these. Regardless, you can declare which targets are disabled, by writing a custom pattern for the -e
/ --exclude-targets
flag.
Some targets may lack stock support for the Rust std
library. This is common for bare metal or embedded targets. For these kinds of targets, you have several strategies for resolution:
std
implementation. Reach out to specialists for the specific target involved.std
library, in both your code, as well as the dependency tree. This is actually common practice for many Rust projects, as an proactive stance on embedded development support.crit hides a lot of compiler noise. While a target is building, you can use common Docker commands to inspect the compilation process:
docker ps -a
docker logs [--follow] <container id>
Yes, it sure is! Almost as slow as using Virtual Machines for cross-compilation.
Rustaceans come to expect that the Rust compiler is analytical, spending more time optimizing programs, so that the final binaries will run safer and faster. The Rust compiler often taking a long time to compile each individual target.
Naturally, when cross-compiling multiple targets, that time multiplies by the number of targets.
Some cross-compilation performance tips:
codegen-units
, lto
, strip
, etc.)--
)-e <target pattern>
)