本文介绍了如何修复Rust错误“找不到链接器'cc'"? Windows 10上的Debian版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 10(Linux的Windows子系统)上运行Debian,并使用以下命令安装了Rust:

I'm running Debian on Windows 10 (Windows Subsystem for Linux) and installed Rust using the command:

curl https://sh.rustup.rs -sSf | sh

安装过程中没有错误,但是当我尝试使用rustc进行编译时,出现了错误linker 'cc' not found.

There were no errors in the install, but when I tried to compile with rustc I got the error linker 'cc' not found.

推荐答案

Linux Rust安装程序不检查编译器工具链,但似乎假设您已经安装了C链接器!最好的解决方案是安装久经考验的gcc工具链.

The Linux Rust installer doesn't check for a compiler toolchain, but seems to assume that you've already got a C linker installed! The best solution is to install the tried-and-true gcc toolchain.

sudo apt install build-essential

如果您需要定位另一种体系结构,请安装适当的工具链并按如下所示定位编译:

If you need to target another architecture, install the appropriate toolchain and target the compilation as follows:

rustc --target=my_target_architecture -C linker=target_toolchain_linker my_rustfile.rs

这篇关于如何修复Rust错误“找不到链接器'cc'"? Windows 10上的Debian版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:33