错误: 链接到 `cc` 失败: 退出码: 1
错误: 链接到 `cc` 失败: 退出码: 1
我有一个.rs文件。当我使用rustc test1.rs
编译它时,我遇到了一个错误:
error: 使用`cc`链接失败: 退出代码: 1
note: cc '-m64' '-L' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib' '-o' 'test1' 'test1.o' '-Wl,-force_load,/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a' '-Wl,-dead_strip' '-nodefaultlibs' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libstd-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libcollections-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libunicode-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/librand-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/liballoc-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/liblibc-4e7c5e5c.rlib' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib/libcore-4e7c5e5c.rlib' '-L' '/usr/local/Cellar/rust/1.0.0-alpha/lib/rustlib/x86_64-apple-darwin/lib' '-L' '/Users/alex/Documents/projects/rust/.rust/lib/x86_64-apple-darwin' '-L' '/Users/alex/Documents/projects/rust/lib/x86_64-apple-darwin' '-lSystem' '-lpthread' '-lc' '-lm' '-lcompiler-rt'
note: ld: 警告: 选项'-L/Users/alex/Documents/projects/rust/.rust/lib/x86_64-apple-darwin'的目录未找到
ld: 警告: 选项'-L/Users/alex/Documents/projects/rust/lib/x86_64-apple-darwin'的目录未找到
ld: 无法打开输出文件以写入: test1,errno=21,架构为x86_64
clang: 错误: 链接器命令失败,退出代码为1(使用-v查看调用)
error: 由于先前的错误而中止
$ rustc --version
rustc 1.0.0-dev
我看过一些与这个问题相关的主题,但没有一个能帮助我解决问题。