我从github派生了这个项目:https://github.com/noshu/rustimization。我没有做任何更改,但当我尝试构建它时,我得到了以下错误:
> error: linking with `cc` failed: exit status: 1
> = note: "cc" "-m64" "-arch" "x86_64" "/var/folders/9p/vn291mlj18g1s13y49tl7r780000gn/T/rustcdxNviS/symbols.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.1elk7eapwf6th3m4.rcgu.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.3ja3qdfz07zdy10g.rcgu.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.3wrnm2croi9nx3su.rcgu.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.4941s2k698xjahpq.rcgu.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.4dueq9qi17an9kqf.rcgu.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.4i2dq61vnyqmm4hp.rcgu.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.55wqt8z3oo73cqfs.rcgu.o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043.2nejxb5chza08iku.rcgu.o"
> "-L" "/Users/.../Rust_projects/rustimization/target/debug/deps" "-L"
> "/Users/.../Rust_projects/rustimization/target/debug/build/cg-sys-2e4601b1e32b5b5a/out"
> "-L"
> "/Users/.../Rust_projects/rustimization/target/debug/build/lbfgsb-sys-05c66ed3722a688a/out"
> "-L"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libtest-b8ae997aa0cbfbe0.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-07cf3334e5fa8a10.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunicode_width-d51772ee7a6845b0.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_std-7cb5b1914c544a60.rlib" "/Users/.../Rust_projects/rustimization/target/debug/deps/libcg_sys-7df527904c8ead66.rlib"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/liblbfgsb_sys-5fa6b26a122e418c.rlib"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/liblibc-5e495cc591277c08.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-0f7ee384278ce82b.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-6023318e4257fdb3.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-50ed95d28fda9497.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-114781e2905bc242.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-841a5df74cbbcf8e.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-9b35810dd2e8e276.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-d44decaafa04c51d.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-aa335e35e4a7724c.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-7ac72202be300078.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-2930c6f21f36f92f.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libadler-654445a53da668f3.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-ce034a3eed8d4113.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-51412ab8efb0f481.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-1c20aac4d9e33893.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-5559092a2ede5191.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-05250b6a4768a099.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-10f98b32877a2067.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-56d27115b82c9961.rlib"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-8b28a0a374c38504.rlib"
> "-lcgfam" "-lgfortran" "-llbfgs" "-lgfortran" "-liconv" "-lSystem"
> "-lresolv" "-lc" "-lm" "-liconv" "-L"
> "/Users/.../.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib"
> "-o"
> "/Users/.../Rust_projects/rustimization/target/debug/deps/rustimization-3af854d2948fc043"
> "-Wl,-dead_strip" "-nodefaultlibs" "-undefined" "dynamic_lookup"
> "-undefined" "dynamic_lookup"
> = note: ld: library not found for -lgfortran
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是我从rustc --version --verbose
得到的
rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-apple-darwin
release: 1.64.0
LLVM version: 14.0.6
从各种论坛我已经尝试:
- 安装gcc
- 重置xcode-选择
- 在.cargo文件夹中设置config.toml,如下所示
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
1条答案
按热度按时间wpx232ag1#
您应该安装xcode-select: