我无法安装diesel-cli以与火箭一起使用[重复]
Posted
技术标签:
【中文标题】我无法安装diesel-cli以与火箭一起使用[重复]【英文标题】:I am unable to install diesel-cli to use with rocket [duplicate] 【发布时间】:2021-12-18 01:38:07 【问题描述】:我已前往官方 Diesel Repository 寻找解决方案,但他们指出这是一个环境问题
按照文档说明设置 Rocket-cli 时:
cargo install diesel_cli --no-default-features --features "postgres"
我收到以下错误:
ayim@Odhiambos-MacBook-Pro ~/Code/payment-service/ RUSTFLAGS='-L /opt/homebrew/opt/libpq/lib' cargo install diesel_cli --no-default-features --features postgres
Updating crates.io index
Installing diesel_cli v1.4.1
Compiling libc v0.2.106
Compiling autocfg v1.0.1
Compiling proc-macro2 v1.0.32
Compiling unicode-xid v0.2.2
Compiling memchr v2.4.1
Compiling cfg-if v1.0.0
Compiling syn v1.0.81
Compiling cc v1.0.71
Compiling unicode-xid v0.0.4
Compiling pq-sys v0.4.6
Compiling adler v1.0.2
Compiling tinyvec_macros v0.1.0
Compiling serde_derive v1.0.130
Compiling gimli v0.26.1
Compiling bitflags v1.3.2
Compiling regex v0.2.11
Compiling rustc-demangle v0.1.21
Compiling ucd-util v0.1.8
Compiling ppv-lite86 v0.2.15
Compiling serde v1.0.130
Compiling lazy_static v1.4.0
Compiling quote v0.3.15
Compiling unicode-width v0.1.9
Compiling matches v0.1.9
Compiling unicode-bidi v0.3.7
Compiling utf8-ranges v1.0.4
Compiling byteorder v1.4.3
Compiling remove_dir_all v0.5.3
Compiling ansi_term v0.11.0
Compiling strsim v0.8.0
Compiling percent-encoding v1.0.1
Compiling vec_map v0.8.2
Compiling synom v0.11.3
Compiling tinyvec v1.5.0
Compiling miniz_oxide v0.4.4
Compiling num-traits v0.2.14
Compiling num-integer v0.1.44
Compiling regex-syntax v0.5.6
Compiling thread_local v0.3.6
Compiling textwrap v0.11.0
Compiling backtrace v0.3.63
Compiling syn v0.11.11
Compiling unicode-normalization v0.1.19
Compiling addr2line v0.17.0
Compiling object v0.27.1
Compiling aho-corasick v0.6.10
Compiling getrandom v0.2.3
Compiling time v0.1.43
Compiling atty v0.2.14
Compiling idna v0.1.5
Compiling quote v1.0.10
Compiling rand_core v0.6.3
Compiling clap v2.33.3
Compiling url v1.7.2
Compiling derive-error-chain v0.10.1
Compiling rand_chacha v0.3.1
Compiling chrono v0.4.19
Compiling rand v0.8.4
Compiling error-chain v0.10.0
Compiling tempfile v3.2.0
Compiling dotenv v0.10.1
Compiling diesel_derives v1.4.1
Compiling diesel v1.4.8
Compiling toml v0.4.10
Compiling migrations_internals v1.4.1
Compiling diesel_cli v1.4.1
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "-arch" "x86_64" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.0.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.1.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.10.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.11.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.12.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.13.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.14.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.15.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.2.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.3.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.4.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.5.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.6.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.7.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.8.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.diesel.b313cccd-cgu.9.rcgu.o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9.5awhse2ietp6nxf3.rcgu.o" "-L" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps" "-L" "/opt/homebrew/opt/libpq/lib" "-L" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/liburl-cde328360789a7d5.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libpercent_encoding-01d7656a20b20790.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libidna-76e0a95b8f7f395d.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libunicode_normalization-2a43e243a362b553.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libtinyvec-79afa6871f95aefe.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libtinyvec_macros-c00321717a797816.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libunicode_bidi-85936053937f6f22.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libmatches-d8a1c956a213bfb7.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libtoml-92d73555edbefaf2.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libtempfile-7c24b2a76f4bd2e5.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/librand-457c78b8c58c0c74.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/librand_chacha-7273007706ceab14.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libppv_lite86-9837db3d6f28adff.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/librand_core-09b269b7159622c1.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libgetrandom-470b76d0b4388064.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libremove_dir_all-cf86da1521ecb5ae.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libserde-014f9d2ccaf8d17d.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libmigrations_internals-140fc357026c7e87.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libdotenv-e915acdd335d40c7.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libregex-8e801f47c1aff68b.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libutf8_ranges-d3dd36004c29cca9.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libregex_syntax-ec70687302aa1cce.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libucd_util-1fd79718d211f8f1.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libthread_local-2081babcaaccf22f.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/liblazy_static-7e9671b862057544.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libaho_corasick-30fc4565323e43ab.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/liberror_chain-1e5b8626d1f70437.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libbacktrace-e025bddc75931375.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libobject-c6680e76db3a3e00.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libmemchr-8bb4f8303a8c9ce2.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libaddr2line-40a2df7c1389a468.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libgimli-0d0105c3562ac613.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libcfg_if-20a1464df94bfea7.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/librustc_demangle-c25c242b8d44dc5b.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libdiesel-e172002c632f902f.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libpq_sys-0f40f0ed6b938145.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libbyteorder-c9a2d09efafc3abd.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libclap-7938b9b4b6708b1d.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libvec_map-f5cde618dab7a12f.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libtextwrap-f537478cfd5a731b.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libunicode_width-7b0da7fb4d604e92.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libstrsim-f2368440e70b7f65.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libbitflags-ed78887d22071e80.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libatty-34f9e7e12c5d5406.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libansi_term-021d072a81d9d9ad.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libchrono-d35e706932af43dd.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libnum_integer-41028b4c5bb44412.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libnum_traits-b91df71d47c663a8.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/libtime-58b4ac0427c8c3a8.rlib" "/private/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/liblibc-443d5015d8549abb.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-8ae2edd646da4ea0.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-47c5cc91a00140fb.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-0635b3ffd941fa76.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-12f450400d05eaa8.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-804bd071f93d6e75.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-f332340a1082559f.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-dde3e8fabbe181c1.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-c36c713681e58b9e.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-87a78d4c56f6dd13.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-9300ab98f79fcb3b.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-cfe930b5c1e0407c.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-e99436e9ec713221.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-0fe32f79765a3820.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-26802d5ee2a9c482.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-1ea009dd7ebe6325.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-31b098f8a2fd6989.rlib" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-bc8e57a7c90d33c8.rlib" "-lpq" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/ayim/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg/release/deps/diesel-3da68ce6b8d39ed9" "-Wl,-dead_strip" "-nodefaultlibs"
= note: ld: warning: directory not found for option '-L/opt/homebrew/opt/libpq/lib'
ld: library not found for -lpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: failed to compile `diesel_cli v1.4.1`, intermediate artifacts can be found at `/var/folders/36/vf9xqhns0fd4q30wgynrj2tc0000gp/T/cargo-install0fC8Yg`
Caused by:
could not compile `diesel_cli` due to previous error
|> 如您所见,我使用RUSTFLAGS='-L /opt/homebrew/opt/libpq/lib' cargo install diesel_cli --no-default-features --features postgres
标志为我的macbook 使用特定版本
【问题讨论】:
我遇到了完全相同的问题。 【参考方案1】:请阅读编译器错误信息。它清楚地说明了问题所在:
= note: ld: warning: directory not found for option '-L/opt/homebrew/opt/libpq/lib' ld: library not found for -lpq clang: error: linker command failed with exit code 1 (use -v to see invocation)
第一行表示您指定的目录不存在,而第二行表示链接器找不到libpq
。两者都表明您的环境存在问题,而不是任何涉及的库。您需要在编译器已知的位置提供libpq
的兼容副本。由于这取决于您的环境,因此其他任何人都无法在这里为您提供帮助。
【讨论】:
我遇到了类似的问题,但对我来说,它是通过仅使用 Postgres 安装柴油来解决的,就像他们正在做的那样:cargo install diesel_cli --no-default-features --features postgres
以上是关于我无法安装diesel-cli以与火箭一起使用[重复]的主要内容,如果未能解决你的问题,请参考以下文章
如何在 NixOS 和 cargo 下安装具有 sqlite 支持的diesel-cli?
无法使用别名获取多个 ssh 密钥以与 BitBucket 一起使用
如何设置安装了 conda 的 R 以与 RStudio 一起使用?
如何在 OSX 上正确安装 Python 以与 OpenCV 一起使用?