Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey,
The current version on main doesn't build on Alpine linux, failing with the error:
Researching a little into this issue (one, two) seems to point to the fact that proc-macro crates cannot be compiled statically. This is not usually a problem because proc-macro crates are built to the host's target, and I assume your hosts are all
x86_64-unknown-linux-gnu, and thus they don't get thetarget.'cfg(target_env = "musl")'clause applied to them even when cross-compiling to musl. However, when building on Alpine, the host's target is in fact musl and cargo tries to statically link proc-macro creates (and build scripts).I am not sure if your CI somehow relies on this clause - to the best of my knowledge, cross-compiling musl binaries on non-musl systems (e.g. running
cargo build --target x86_64-unknown-linux-muslon a Debian machine) already uses static linking by default, and thus explicitly specifying+crt-statichere should be redundant. However, if you do need to somehow pass-C target-feature=+crt-staticexplicitly, you should do this in the CI pipeline where it is required and not in Cargo's global config.toml (note that when cross compiling with--targetand passing customrustflagsat the same time, Cargo has a useful feature where it passes these rustflags only to binaries targeting the destination architecture, and not to host-triplet targets, thus preventing breakage of this sort in that case).