Skip to content

Troubleshooting Rust Linker Failures on macOS (linking with cc failed: exit status: 1) #204

Answered by Dwlad90
derekjwilliams asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @derekjwilliams,

I had the same problem with a M1 machine. This problem also existed on previous versions of MacOS.

The solution was one of the solutions suggested in the link above, add ~/.cargo/config.toml (https://doc.rust-lang.org/cargo/reference/config.html) file with the following content:

Following the suggestion here: https://stackoverflow.com/questions/28124221/error-linking-with-cc-failed-exit-code-1

[target.x86_64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

After that, this problem did not occur again.

Perhaps …

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by derekjwilliams
Comment options

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

Comment options

You must be logged in to vote
3 replies
@Dwlad90
Comment options

@derekjwilliams
Comment options

@Dwlad90
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants