Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the crt-static target feature for all targets #63

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

lmbarros
Copy link
Contributor

@lmbarros lmbarros commented Mar 1, 2024

We were relying on the fact that our current targets link the C runtime
statically. However, this may be different for other targets and could
even change in the future (e.g., see
rust-lang/compiler-team#422).

With this commit we adopt the current recommendation, which is enabling
the crt-static target feature when building. See
https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes
for details.

Given the current defaults for Rust targets, this change should be a
no-op, but this shall make us safer and more resilient to Rust changes
in the long run.

@lmbarros lmbarros force-pushed the lmb/static-builds branch 4 times, most recently from ab2c369 to f5c7797 Compare March 6, 2024 14:44
We were relying on the fact that our current targets link the C runtime
statically. However, this may be different for other targets and could
even change in the future (e.g., see
rust-lang/compiler-team#422).

With this commit we adopt the current recommendation, which is enabling
the crt-static target feature when building. See
https://doc.rust-lang.org/reference/linkage.html#static-and-dynamic-c-runtimes
for details.

Given the current defaults for Rust targets, this change should be a
no-op, but this shall make us safer and more resilient to Rust changes
in the long run.

Signed-off-by: Leandro Motta Barros <leandro@balena.io>
Change-type: patch
@lmbarros lmbarros changed the title [WIP] Test env var Enable the crt-static target feature for all targets Mar 7, 2024
@lmbarros lmbarros marked this pull request as ready for review March 7, 2024 12:15
Copy link
Contributor

@rahul-thakoor rahul-thakoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the flag is being passed correctly

+ /usr/bin/docker run --userns host -e 'RUSTFLAGS=-C target-feature=+crt-static' -e 'PKG_CONFIG_ALLOW_CROSS=1' -e 'XARGO_HOME=/xargo' -e 'CARGO_HOME=/cargo' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e CARGO_REGISTRY -e CARGO_TERM_COLOR -e CARGO_INCREMENTAL -e 'USER=runner' --rm --user 1001:127 -v /home/runner/.xargo:/xargo:z -v /home/runner/.cargo:/cargo:z -v /cargo/bin -v /home/runner/work/takeover/takeover:/project:z -v /home/runner/.rustup/toolchains/1.76-x86_64-unknown-linux-gnu:/rust:z,ro -v /home/runner/work/takeover/takeover/target:/target:z -w /project ghcr.io/cross-rs/aarch64-unknown-linux-musl:0.2.5 sh -c 'PATH=$PATH:/rust/bin cargo -v build --release --target aarch64-unknown-linux-musl'

@rahul-thakoor rahul-thakoor merged commit e9a6949 into master Mar 7, 2024
54 checks passed
@rahul-thakoor rahul-thakoor deleted the lmb/static-builds branch March 7, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants