RUST在cenos上编译x86的程序报错:linker `cc` not found

925 阅读1分钟

首次在centos上执行cargo运行rust程序报错,如下:

cargo build --target=x86_64-unknown-linux-musl Compiling proc-macro2 v1.0.59

error: linker cc not found

note: No such file or directory (os error 2)

error: could not compile proc-macro2 (build script) due to previous error

原因:机器上缺少相关的库,但是具体的库没有深究,针对不同的系统,可以采用如下命令解决

ubuntu操作系统: apt-get install build-essential

centos操作系统: yum groupinstall "Development Tools"