Skip to content
Discussion options

You must be logged in to vote

There are two separate things to fix here.

With libc 0.2.191 on x86_64-unknown-linux-gnu, use:

[dependencies]
libc = { version = "=0.2.191", default-features = false }

The crate is already no_std. Its default feature named std assumes Rust's actual std supplies the native library links; with that feature disabled, this release emits the GNU/Linux native links itself, including c. -nostartfiles omits CRT startup objects but does not itself add -lc.

Scope the startup flag to the target and pass --target explicitly:

# .cargo/config.toml
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-nostartfiles"]
cargo build --release --target x86_64-unknown-linux-gnu

Even when host and tar…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@tgross35
Comment options

Answer selected by peter-lyons-kehl
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants