Skip to content

don't link libc#4

Open
Twey wants to merge 1 commit into
viraptor:masterfrom
Twey:master
Open

don't link libc#4
Twey wants to merge 1 commit into
viraptor:masterfrom
Twey:master

Conversation

@Twey

@Twey Twey commented Sep 7, 2021

Copy link
Copy Markdown

It is not necessary to link libc manually, as libc is already
contained in liblibc.rlib which gets linked in automatically.

This link annotation is harmful as in static situations (where
target_feature="crt-static") it will force linking the dynamic libc,
producing chimera binaries or breaking the build entirely.

It is not necessary to link libc manually, as libc is already
contained in `liblibc.rlib` which gets linked in automatically.

This link annotation is harmful as in static situations (where
target_feature="crt-static") it will force linking the dynamic libc,
producing chimera binaries or breaking the build entirely.
@yuqitao

yuqitao commented Sep 9, 2021

Copy link
Copy Markdown

I built my project with cargo build --release --target aarch64-unknown-linux-musl.
I got this rust-lang/rust#46651 first. So I add rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ]. then build successfully. But when I run it, I got Segmentation fault. It seems that we can solve this problem with your commit.

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