0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dieselのインストール時に"error: linking with `cc` failed: exit code: 1"が出たときの対処法

0
Posted at
cargo install diesel_cli --no-default-features --features postgres

これでDieselをインストールするときに以下のエラーがでる。

ちなみにPostgresql本体をインストールしていてもこのエラーは出ます。

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.0.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.1.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.10.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.11.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.12.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.13.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.14.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.15.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.2.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.3.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.4.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.5.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.6.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.7.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.8.rcgu.o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.diesel.6kvw4kha-cgu.9.rcgu.o" "-o" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449" "/tmp/cargo-installLDWx4J/release/deps/diesel-dc253958ad230449.ldafkp87ay1aks1.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installLDWx4J/release/deps" "-L" "/usr/lib/x86_64-linux-gnu" "-L" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/cargo-installLDWx4J/release/deps/liburl-434ac20774a64d97.rlib" "/tmp/cargo-installLDWx4J/release/deps/libpercent_encoding-5ceff6c3a4c24c73.rlib" "/tmp/cargo-installLDWx4J/release/deps/libidna-998d0e1d893c1e66.rlib" "/tmp/cargo-installLDWx4J/release/deps/libunicode_normalization-dbb668f724d1b981.rlib" "/tmp/cargo-installLDWx4J/release/deps/libtinyvec-322d847c60b8e647.rlib" "/tmp/cargo-installLDWx4J/release/deps/libtinyvec_macros-26f28bf321070a5e.rlib" "/tmp/cargo-installLDWx4J/release/deps/libunicode_bidi-69326d5e28523a54.rlib" "/tmp/cargo-installLDWx4J/release/deps/libmatches-49f64d78ac8b77d2.rlib" "/tmp/cargo-installLDWx4J/release/deps/libtoml-b7ebfd6938d7bc83.rlib" "/tmp/cargo-installLDWx4J/release/deps/libtempfile-e3100b6aa0d3e4d4.rlib" "/tmp/cargo-installLDWx4J/release/deps/librand-69ff22028c36b257.rlib" "/tmp/cargo-installLDWx4J/release/deps/librand_chacha-ae5c259421f3de58.rlib" "/tmp/cargo-installLDWx4J/release/deps/libppv_lite86-4aad96f58c304b26.rlib" "/tmp/cargo-installLDWx4J/release/deps/librand_core-8553b1aaa89c9a5f.rlib" "/tmp/cargo-installLDWx4J/release/deps/libgetrandom-8c4047d839d2bf53.rlib" "/tmp/cargo-installLDWx4J/release/deps/libremove_dir_all-35551f2e396fa83e.rlib" "/tmp/cargo-installLDWx4J/release/deps/libserde-ad194da2c5c271d6.rlib" "/tmp/cargo-installLDWx4J/release/deps/libmigrations_internals-5073a19af69f84dc.rlib" "/tmp/cargo-installLDWx4J/release/deps/libdotenv-002640fa0424c9fc.rlib" "/tmp/cargo-installLDWx4J/release/deps/libregex-ffad36622da47c82.rlib" "/tmp/cargo-installLDWx4J/release/deps/libutf8_ranges-a1f46f73850bb981.rlib" "/tmp/cargo-installLDWx4J/release/deps/libregex_syntax-2608940a61c4a55a.rlib" "/tmp/cargo-installLDWx4J/release/deps/libucd_util-d0e193eeb17475cb.rlib" "/tmp/cargo-installLDWx4J/release/deps/libthread_local-b76d60cb3b0ff40f.rlib" "/tmp/cargo-installLDWx4J/release/deps/liblazy_static-7838e4e1e8aa819d.rlib" "/tmp/cargo-installLDWx4J/release/deps/libaho_corasick-e4df4b6fbc625909.rlib" "/tmp/cargo-installLDWx4J/release/deps/libmemchr-b069fee841f12d3e.rlib" "/tmp/cargo-installLDWx4J/release/deps/liberror_chain-f909a8e3f469cdc1.rlib" "/tmp/cargo-installLDWx4J/release/deps/libbacktrace-1461e14f88f553da.rlib" "/tmp/cargo-installLDWx4J/release/deps/libminiz_oxide-a8bf6954a40d2e67.rlib" "/tmp/cargo-installLDWx4J/release/deps/libadler-3d2dfd5868192abb.rlib" "/tmp/cargo-installLDWx4J/release/deps/libobject-9be1ef9b7785053d.rlib" "/tmp/cargo-installLDWx4J/release/deps/libaddr2line-e2f1bfbbe48e656e.rlib" "/tmp/cargo-installLDWx4J/release/deps/libgimli-4fabdeae3b437c69.rlib" "/tmp/cargo-installLDWx4J/release/deps/libcfg_if-6443c9fece9c5a8b.rlib" "/tmp/cargo-installLDWx4J/release/deps/librustc_demangle-f4ab8b54ec54ece8.rlib" "/tmp/cargo-installLDWx4J/release/deps/libdiesel-9c3350904d6865a3.rlib" "/tmp/cargo-installLDWx4J/release/deps/libpq_sys-aafda7f2bb945a88.rlib" "/tmp/cargo-installLDWx4J/release/deps/libbyteorder-c97e92207226d6ea.rlib" "/tmp/cargo-installLDWx4J/release/deps/libclap-c526051765af2762.rlib" "/tmp/cargo-installLDWx4J/release/deps/libvec_map-aa70a9b8a46da868.rlib" "/tmp/cargo-installLDWx4J/release/deps/libtextwrap-fa17f008fcb6a641.rlib" "/tmp/cargo-installLDWx4J/release/deps/libunicode_width-788a7bb8f6848a2f.rlib" "/tmp/cargo-installLDWx4J/release/deps/libstrsim-0f90bfc1e86d296f.rlib" "/tmp/cargo-installLDWx4J/release/deps/libbitflags-ce22fd3ba40b4cc7.rlib" "/tmp/cargo-installLDWx4J/release/deps/libatty-7dec57944fd8b8e1.rlib" "/tmp/cargo-installLDWx4J/release/deps/libansi_term-87d88f946b658a4b.rlib" "/tmp/cargo-installLDWx4J/release/deps/libchrono-6e0fe72a5d806548.rlib" "/tmp/cargo-installLDWx4J/release/deps/libnum_integer-f11d99110948e2d4.rlib" "/tmp/cargo-installLDWx4J/release/deps/libnum_traits-1922c207acd96335.rlib" "/tmp/cargo-installLDWx4J/release/deps/libtime-42eaef445e9a7444.rlib" "/tmp/cargo-installLDWx4J/release/deps/liblibc-84daafcb68f5c7d3.rlib" "-Wl,--start-group" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-6f77337c1826707d.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e238540f8faf9927.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-78f8506dd5004913.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-c0e64497deb085aa.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-217a514dc8d845c6.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-65e4f8df4b8bbd73.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-fec1b74170245419.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e74f867eb2f15322.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-72a374d36f3d0a31.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-cb9206ed96de54c3.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-33ee81149d314805.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-2e8740599b11634b.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-241cf59851357bea.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-edc29aa8c04b480f.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-6a141406945fda5a.rlib" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-2408224b4af46d83.rlib" "-Wl,--end-group" "/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d36087076e1dd756.rlib" "-Wl,-Bdynamic" "-lpq" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
  = note: /usr/bin/ld: cannot find -lpq
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: failed to compile `diesel_cli v1.4.1`, intermediate artifacts can be found at `/tmp/cargo-installLDWx4J`

Caused by:
  could not compile `diesel_cli`

To learn more, run the command again with --verbose.

これを解消するにはlibpqをインストールする必要があります。

以下のコマンドでインストールできます。

sudo apt install libpq-dev
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?