我如何修正这个错误在MacOS“无法加载CODEGEN后台”?(How do I fix the e

2019-10-31 08:01发布

main.rs:

fn main() {
    println!("Hello world!");
}
$ rustc main.rs:
error: couldn't load codegen backend "/usr/local/lib/rustlib/i686-apple-darwin/codegen-backends/librustc_codegen_llvm-llvm.dylib": "dlsym(RTLD_DEFAULT, CFURLConnectionCreateWithProperties): symbol not found"

我使用的MacOS 10.11.6通过rustup安装锈1.30.1。 GCC是Apple LLVM version 8.0.0 (clang-800.0.42.1)

Answer 1:

我已经经历了x86上的的Gentoo系统同样的问题。 出于某种原因,该代码生成库已安装

/usr/lib/rust-1.34.2/rust-1.34.2/rustlib/i686-unknown-linux-gnu/codegen-backends

注意重复rust-1.34.2目录。

我的解决办法是符号链接从预期的地方目录; 你必须这样做root特权:

# cd /usr/lib/rust-1.34.2/rustlib/i686-unknown-linux-gnu/
# ln -s ../../rust-1.34.2/rustlib/i686-unknown-linux-gnu/codegen-backends .

您可能需要重复安装锈病的新版本时。



文章来源: How do I fix the error “couldn't load codegen backend” on macOS?
标签: rust