如何在 M1 Macbook 上安装 Cargo Generate
How to Install Cargo Generate on M1 Macbook
我正在尝试在我的 M1 Macbook air 上安装 cargo-generate。看起来链接器正在寻找 x86_64
版本的 openssl
:
λ: cargo install cargo-generate
Updating crates.io index
Installing cargo-generate v0.13.1
Compiling libc v0.2.126
...
// ********** snipped **********
...
Compiling pest_derive v2.1.0
Compiling thiserror-impl v1.0.31
Compiling structopt-derive v0.4.18
Compiling rhai_codegen v1.4.0
Compiling failure v0.1.8
Compiling pwd v1.3.1
Compiling git-config v0.2.1
Compiling thiserror v1.0.31
Compiling rhai v1.7.0
Compiling structopt v0.3.26
Compiling kstring v2.0.0
Compiling toml v0.5.9
Compiling liquid-core v0.26.0
Compiling liquid-lib v0.26.0
Compiling liquid v0.26.0
Compiling git2 v0.14.2
Compiling cargo-generate v0.13.1
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-arch" "arm64" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/deps/cargo_generate-3b067bb1f3f7f98a.cargo_generate.1172600b-cgu.0.rcgu.o" "-L" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/deps" "-L" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/build/libgit2-sys-33c3e15ed2a1170c/out/build" "-L" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/build/libssh2-sys-d45cf615a1338664/out/build" "-L" "/usr/local/opt/openssl@3/lib" "-L" "/Users/carsonrajcan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/rustcgt1KX4/liblibgit2_sys-ea90ee25efac1064.rlib" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/rustcgt1KX4/liblibssh2_sys-31bfafe03b9ec440.rlib" "/Users/carsonrajcan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-4d2eba102ddf9fce.rlib" "-liconv" "-framework" "Security" "-framework" "CoreFoundation" "-lssl" "-lcrypto" "-lz" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/carsonrajcan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/deps/cargo_generate-3b067bb1f3f7f98a" "-Wl,-dead_strip" "-nodefaultlibs"
= note: ld: warning: ignoring file /usr/local/opt/openssl@3/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/opt/openssl@3/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_EVP_ripemd160", referenced from:
_mac_method_hmac_ripemd160_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_EVP_md5", referenced from:
_mac_method_hmac_md5_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_HMAC_Final", referenced from:
_mac_method_hmac_sha2_256_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha2_512_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha1_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_md5_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_ripemd160_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_HMAC_CTX_free", referenced from:
_mac_method_hmac_sha2_256_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha2_512_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha1_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_md5_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_ripemd160_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_EVP_cast5_cbc", referenced from:
_libssh2_crypt_method_cast128_cbc in liblibssh2_sys-31bfafe03b9ec440.rlib(crypt.o)
...
// ********** snipped **********
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: failed to compile `cargo-generate v0.13.1`, intermediate artifacts can be found at `/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR`
Caused by:
could not compile `cargo-generate` due to previous error
我不确定我的系统上的 openssl 版本是否正确。
如何确保我安装了正确的 (macOS-arm64
) openssl
版本并且对链接器可见?
或者如果这不是问题,我如何让编译器与我现有的版本很好地兼容?
我仍然不确定您将如何使用系统的 openssl
,但正如@Netwave 所建议的,无论如何我都能够使用 vendored-openssl
标志继续:
cargo install cargo-generate --features vendored-openssl
我在 docs 中找到的。
您必须启用 vendored-openssl
标志:
cargo install cargo-generate --features "vendored-openssl"
我正在尝试在我的 M1 Macbook air 上安装 cargo-generate。看起来链接器正在寻找 x86_64
版本的 openssl
:
λ: cargo install cargo-generate
Updating crates.io index
Installing cargo-generate v0.13.1
Compiling libc v0.2.126
...
// ********** snipped **********
...
Compiling pest_derive v2.1.0
Compiling thiserror-impl v1.0.31
Compiling structopt-derive v0.4.18
Compiling rhai_codegen v1.4.0
Compiling failure v0.1.8
Compiling pwd v1.3.1
Compiling git-config v0.2.1
Compiling thiserror v1.0.31
Compiling rhai v1.7.0
Compiling structopt v0.3.26
Compiling kstring v2.0.0
Compiling toml v0.5.9
Compiling liquid-core v0.26.0
Compiling liquid-lib v0.26.0
Compiling liquid v0.26.0
Compiling git2 v0.14.2
Compiling cargo-generate v0.13.1
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-arch" "arm64" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/deps/cargo_generate-3b067bb1f3f7f98a.cargo_generate.1172600b-cgu.0.rcgu.o" "-L" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/deps" "-L" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/build/libgit2-sys-33c3e15ed2a1170c/out/build" "-L" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/build/libssh2-sys-d45cf615a1338664/out/build" "-L" "/usr/local/opt/openssl@3/lib" "-L" "/Users/carsonrajcan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/rustcgt1KX4/liblibgit2_sys-ea90ee25efac1064.rlib" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/rustcgt1KX4/liblibssh2_sys-31bfafe03b9ec440.rlib" "/Users/carsonrajcan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-4d2eba102ddf9fce.rlib" "-liconv" "-framework" "Security" "-framework" "CoreFoundation" "-lssl" "-lcrypto" "-lz" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/carsonrajcan/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR/release/deps/cargo_generate-3b067bb1f3f7f98a" "-Wl,-dead_strip" "-nodefaultlibs"
= note: ld: warning: ignoring file /usr/local/opt/openssl@3/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/opt/openssl@3/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_EVP_ripemd160", referenced from:
_mac_method_hmac_ripemd160_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_EVP_md5", referenced from:
_mac_method_hmac_md5_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_HMAC_Final", referenced from:
_mac_method_hmac_sha2_256_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha2_512_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha1_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_md5_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_ripemd160_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_HMAC_CTX_free", referenced from:
_mac_method_hmac_sha2_256_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha2_512_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_sha1_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_md5_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
_mac_method_hmac_ripemd160_hash in liblibssh2_sys-31bfafe03b9ec440.rlib(mac.o)
"_EVP_cast5_cbc", referenced from:
_libssh2_crypt_method_cast128_cbc in liblibssh2_sys-31bfafe03b9ec440.rlib(crypt.o)
...
// ********** snipped **********
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: failed to compile `cargo-generate v0.13.1`, intermediate artifacts can be found at `/var/folders/1t/n07x82ln3gn5b40gnv28x_cc0000gn/T/cargo-install93sXCR`
Caused by:
could not compile `cargo-generate` due to previous error
我不确定我的系统上的 openssl 版本是否正确。
如何确保我安装了正确的 (macOS-arm64
) openssl
版本并且对链接器可见?
或者如果这不是问题,我如何让编译器与我现有的版本很好地兼容?
我仍然不确定您将如何使用系统的 openssl
,但正如@Netwave 所建议的,无论如何我都能够使用 vendored-openssl
标志继续:
cargo install cargo-generate --features vendored-openssl
我在 docs 中找到的。
您必须启用 vendored-openssl
标志:
cargo install cargo-generate --features "vendored-openssl"