rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.89k stars 12.67k forks source link

Error : linking with `cc` failed: exit status: 1 in Rust #124880

Open VyomPatel0109 opened 5 months ago

VyomPatel0109 commented 5 months ago

Error : linking with cc failed: exit status: 1

I got above error when I tried to run my rust project using Cargo run command on free tier EC2 instance of AWS. How to resolve it?

jieyouxu commented 5 months ago

We need more information than that to even try to understand what is wrong.

WyntersN commented 5 months ago

我们需要更多的信息才能尝试了解问题所在。

  • rustc 版本是什么?( rustc --version --verbose)
  • 请发布_完整的_错误消息。Error : linking with cc failed: exit status: 1非常模糊。您是否有一个依赖项,该依赖项具有一个构建脚本,该脚本假设可以链接到某些库(例如某些*-sys板条箱)?
  • 我们如何重现您的问题?_您是否有一个货物项目可以在不_处于 EC2 环境中的情况下重现链接失败的问题?

release: 1.78.0 LLVM version: 18.1.2

could not compile rust-i18n-macro (lib) due to 1 previous error

Error: Cargo build failed from Linux

jieyouxu commented 5 months ago

Please also post your Cargo.toml. "linking with cc failed" usually indicates that one or more of your dependencies assumes or requires some library to be available on your system, but that said library is not available to the linker for one reason or another.

WyntersN commented 5 months ago

Please also post your Cargo.toml. "linking with cc failed" usually indicates that one or more of your dependencies assumes or requires some library to be available on your system, but that said library is not available to the linker for one reason or another.

Is there any way? I'm using Docker

docker rust:alpine3.19

WyntersN commented 5 months ago

alpine3.19 build success

apk update
apk add --no-cache -U build-base