Diesel: Could not compile diesel_cli

Created on 1 Apr 2019  Â·  25Comments  Â·  Source: diesel-rs/diesel

Setup

Versions

  • Rust: rustc 1.33.0 (2aa4c46cf 2019-02-28)
  • Database: postgres
  • Operating System Ubuntu 18.04.1 LTS

Feature Flags

  • diesel: postgres

Problem Description

Unable to install diesel_cli

What is the actual output?

cargo install diesel_cli --no-default-features --features postgres

    Updating crates.io index
  Installing diesel_cli v1.4.0
   Compiling proc-macro2 v0.4.27
   Compiling cc v1.0.32
   Compiling libc v0.2.51
   Compiling unicode-xid v0.1.0
   Compiling memchr v2.2.0
   Compiling syn v0.15.29
   Compiling autocfg v0.1.2
   Compiling byteorder v1.3.1
   Compiling unicode-xid v0.0.4
   Compiling rand_core v0.4.0
   Compiling num-traits v0.2.6
   Compiling pq-sys v0.4.6
   Compiling num-integer v0.1.39
   Compiling serde v1.0.89
   Compiling regex v0.2.11
   Compiling smallvec v0.6.9
   Compiling lazy_static v1.3.0
   Compiling rustc-demangle v0.1.13
   Compiling cfg-if v0.1.7
   Compiling ucd-util v0.1.3
   Compiling matches v0.1.8
   Compiling quote v0.3.15
   Compiling bitflags v1.0.4
   Compiling unicode-width v0.1.5
   Compiling utf8-ranges v1.0.2
   Compiling ansi_term v0.11.0
   Compiling percent-encoding v1.0.1
   Compiling vec_map v0.8.1
   Compiling remove_dir_all v0.5.1
   Compiling strsim v0.7.0
   Compiling backtrace-sys v0.1.28
   Compiling backtrace v0.3.14
   Compiling rand_chacha v0.1.1
   Compiling rand_pcg v0.1.2
   Compiling rand v0.6.5
   Compiling synom v0.11.3
   Compiling rand_core v0.3.1
   Compiling rand_jitter v0.1.3
   Compiling unicode-normalization v0.1.8
   Compiling thread_local v0.3.6
   Compiling regex-syntax v0.5.6
   Compiling unicode-bidi v0.3.4
   Compiling textwrap v0.10.0
   Compiling syn v0.11.11
   Compiling rand_xorshift v0.1.1
   Compiling rand_isaac v0.1.1
   Compiling rand_hc v0.1.0
   Compiling idna v0.1.5
   Compiling quote v0.6.11
   Compiling rand_os v0.1.3
   Compiling atty v0.2.11
   Compiling time v0.1.42
   Compiling aho-corasick v0.6.10
   Compiling derive-error-chain v0.10.1
error: failed to compile `diesel_cli v1.4.0`, intermediate artifacts can be found at `/tmp/cargo-installAh6AoH`

Caused by:
  Could not compile `derive-error-chain`.

Caused by:
  process didn't exit successfully: `rustc --crate-name derive_error_chain /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/derive-error-chain-0.10.1/src/lib.rs --color always --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C opt-level=3 -C metadata=0f314aedb4e0a6c9 -C extra-filename=-0f314aedb4e0a6c9 --out-dir /tmp/cargo-installAh6AoH/release/deps -L dependency=/tmp/cargo-installAh6AoH/release/deps --extern quote=/tmp/cargo-installAh6AoH/release/deps/libquote-6c11d4fe1d50bb75.rlib --extern syn=/tmp/cargo-installAh6AoH/release/deps/libsyn-cf3b6b9bbadaa925.rlib --cap-lints allow` (signal: 9, SIGKILL: kill)

Checklist

  • [X] I have already looked over the issue tracker for similar issues.
  • [X] This issue can be reproduced on Rust's stable channel. (Your issue will be
    closed if this is not the case)

Most helpful comment

i install

sudo apt install libpq-dev

and it works. Thanks Guys!

All 25 comments

This might seem like an odd question, but how much memory do you have?

@kieraneglin 512MiB

It seems to be killed by the OS for some reason, I'm on a very low end machine. But diesel_cli has been a huge pain point since I have to compile it everywhere I need to use and it takes a long time.

Most of the times I avoid using it and go directly to the .sql migration files.

But sometimes it's needed, I'm trying to solve it by using a linux virtual machine to compile it in another hardware and scp the binary to the machine I need, but I'm waiting for diesel_cli to compile.

I'd be surprised to find mid-to-large-sized rust program you could compile with 512Mb of ram. Apart from getting more memory, adding some swap space is the only reasonable solution. But it will compile slowly if you start tearing into the swap.

Sure, but I do not compile my third-party binaries. Only diesel.

So it's only a problem if you force your user to compile it because you publish only the source code.

@paulocsanz You may want to look into diesel_migrations to run migrations without building diesel_cli.

@paulocsanz As @weiznich mentions, embedding with diesel_migrations is a great option, I use it in production myself.

Otherwise, you should be able to compile the binary on another machine with the same version of Ubuntu and move the executable over (assuming you have the correct database library installed there too).

It's worth noting that we build Diesel CLI on a machine with 512MB of RAM with no problem (I do not know if it swaps or not)

I have different logs for installing:

codee@ryzen3:~$ cargo install diesel_cli --no-default-features --features postgres
    Updating crates.io index
  Installing diesel_cli v1.4.0
   Compiling proc-macro2 v0.4.27
   Compiling cc v1.0.34
   Compiling unicode-xid v0.1.0
   Compiling libc v0.2.51
   Compiling syn v0.15.30
   Compiling memchr v2.2.0
   Compiling autocfg v0.1.2
   Compiling num-traits v0.2.6
   Compiling pq-sys v0.4.6
   Compiling byteorder v1.3.1
   Compiling unicode-xid v0.0.4
   Compiling rand_core v0.4.0
   Compiling ucd-util v0.1.3
   Compiling cfg-if v0.1.7
   Compiling smallvec v0.6.9
   Compiling quote v0.3.15
   Compiling regex v0.2.11
   Compiling num-integer v0.1.39
   Compiling lazy_static v1.3.0
   Compiling serde v1.0.89
   Compiling matches v0.1.8
   Compiling rustc-demangle v0.1.13
   Compiling utf8-ranges v1.0.2
   Compiling unicode-width v0.1.5
   Compiling bitflags v1.0.4
   Compiling ansi_term v0.11.0
   Compiling remove_dir_all v0.5.1
   Compiling percent-encoding v1.0.1
   Compiling strsim v0.7.0
   Compiling vec_map v0.8.1
   Compiling rand_chacha v0.1.1
   Compiling backtrace v0.3.14
   Compiling rand_pcg v0.1.2
   Compiling rand v0.6.5
   Compiling synom v0.11.3
   Compiling backtrace-sys v0.1.28
   Compiling regex-syntax v0.5.6
   Compiling rand_core v0.3.1
   Compiling rand_jitter v0.1.3
   Compiling unicode-normalization v0.1.8
   Compiling thread_local v0.3.6
   Compiling unicode-bidi v0.3.4
   Compiling textwrap v0.10.0
   Compiling rand_isaac v0.1.1
   Compiling rand_xorshift v0.1.1
   Compiling rand_hc v0.1.0
   Compiling syn v0.11.11
   Compiling rand_os v0.1.3
   Compiling time v0.1.42
   Compiling atty v0.2.11
   Compiling aho-corasick v0.6.10
   Compiling idna v0.1.5
   Compiling quote v0.6.11
   Compiling clap v2.32.0
   Compiling chrono v0.4.6
   Compiling url v1.7.2
   Compiling derive-error-chain v0.10.1
   Compiling tempfile v3.0.7
   Compiling error-chain v0.10.0
   Compiling diesel_derives v1.4.0
   Compiling serde_derive v1.0.89
   Compiling dotenv v0.10.1
   Compiling diesel v1.4.2
   Compiling toml v0.4.10
   Compiling migrations_internals v1.4.0
   Compiling diesel_cli v1.4.0
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.0.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.1.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.10.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.11.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.12.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.13.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.14.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.15.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.2.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.3.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.4.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.5.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.6.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.7.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.8.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.9.rcgu.o" "-o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.3zww99mfmc53sgk6.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installtBXuAW/release/deps" "-L" "/tmp/cargo-installtBXuAW/release/build/backtrace-sys-c3fdfda3286dfeb7/out" "-L" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/cargo-installtBXuAW/release/deps/liburl-b0a144ac385c92d3.rlib" "/tmp/cargo-installtBXuAW/release/deps/libpercent_encoding-3c54b6b409caf9cc.rlib" "/tmp/cargo-installtBXuAW/release/deps/libidna-8736338779bf71a6.rlib" "/tmp/cargo-installtBXuAW/release/deps/libunicode_normalization-c6c83c4b4f063d60.rlib" "/tmp/cargo-installtBXuAW/release/deps/libsmallvec-f5b9c1662b5eedcd.rlib" "/tmp/cargo-installtBXuAW/release/deps/libunicode_bidi-9a7d8afa5f91ca2e.rlib" "/tmp/cargo-installtBXuAW/release/deps/libmatches-4480108f1ef64f65.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtoml-e1779f25d4ccb3a8.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtempfile-e1afe99710f5b97d.rlib" "/tmp/cargo-installtBXuAW/release/deps/libremove_dir_all-8c47dd167514aa2e.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand-51d51249a9835f8e.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_xorshift-7492bf1def6bb26a.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_pcg-0730bee4a5430f55.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_hc-b2b5c08a30538d30.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_chacha-7f5afa7cd2715e2a.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_isaac-e6de3b95fae26f23.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_core-2f4b230967d80f93.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_os-67c51dd38350d3e6.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_jitter-ed66d9521fa95bc6.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_core-788567e395963788.rlib" "/tmp/cargo-installtBXuAW/release/deps/libserde-fc46b82dbb3519a8.rlib" "/tmp/cargo-installtBXuAW/release/deps/libmigrations_internals-66c2af111d89a5db.rlib" "/tmp/cargo-installtBXuAW/release/deps/libdotenv-904ec4bce7ead678.rlib" "/tmp/cargo-installtBXuAW/release/deps/libregex-470f40897bce1347.rlib" "/tmp/cargo-installtBXuAW/release/deps/libutf8_ranges-e48bfb689e611da0.rlib" "/tmp/cargo-installtBXuAW/release/deps/libregex_syntax-d79d68dd5363fdb5.rlib" "/tmp/cargo-installtBXuAW/release/deps/libucd_util-57f7989c5c07c423.rlib" "/tmp/cargo-installtBXuAW/release/deps/libthread_local-092f9d6ccc082d3d.rlib" "/tmp/cargo-installtBXuAW/release/deps/liblazy_static-9967fb62f02a664b.rlib" "/tmp/cargo-installtBXuAW/release/deps/libaho_corasick-3f7aa807f2ff99de.rlib" "/tmp/cargo-installtBXuAW/release/deps/libmemchr-9f0cf6e5a1322d53.rlib" "/tmp/cargo-installtBXuAW/release/deps/liberror_chain-4c3078047c81b35a.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbacktrace-fedf2d4773fd9cb2.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbacktrace_sys-e741afdabdbbcaa4.rlib" "/tmp/cargo-installtBXuAW/release/deps/librustc_demangle-1027d023ad5a58c5.rlib" "/tmp/cargo-installtBXuAW/release/deps/libcfg_if-41f3583e7e446002.rlib" "/tmp/cargo-installtBXuAW/release/deps/libdiesel-2af2d07268ecdea1.rlib" "/tmp/cargo-installtBXuAW/release/deps/libpq_sys-3d4f6e98cd847220.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbyteorder-602cc862f607f690.rlib" "/tmp/cargo-installtBXuAW/release/deps/libclap-83e2a2053c2ad0de.rlib" "/tmp/cargo-installtBXuAW/release/deps/libvec_map-699714b9fbf3bb2a.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtextwrap-611a573871a5a9c3.rlib" "/tmp/cargo-installtBXuAW/release/deps/libunicode_width-c67327480cb3edbd.rlib" "/tmp/cargo-installtBXuAW/release/deps/libstrsim-1cd684f3bcd7452e.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbitflags-21cb679825a027ab.rlib" "/tmp/cargo-installtBXuAW/release/deps/libatty-61f418d426de34d8.rlib" "/tmp/cargo-installtBXuAW/release/deps/libansi_term-5d02bf49ab7e1d32.rlib" "/tmp/cargo-installtBXuAW/release/deps/libchrono-eb43d05533cd8b76.rlib" "/tmp/cargo-installtBXuAW/release/deps/libnum_integer-b05f5d4e9600144f.rlib" "/tmp/cargo-installtBXuAW/release/deps/libnum_traits-3a019df363a5f909.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtime-c07689338d581aaf.rlib" "/tmp/cargo-installtBXuAW/release/deps/liblibc-1dc47802d96d2bda.rlib" "-Wl,--start-group" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e39317eb74365d3c.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4d55a38564aae54a.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-f8521075e248b627.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-7c91ffdc8da860d3.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0ad27b9879d551d3.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-588f18eae3ea58be.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4ebf5caee903d98f.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-8895b32baedb08c6.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-6a9d233d01acc350.rlib" "-Wl,--end-group" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-851bb3b5f6c4db49.rlib" "-Wl,-Bdynamic" "-lpq" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = 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.0`, intermediate artifacts can be found at `/tmp/cargo-installtBXuAW`

Caused by:
  Could not compile `diesel_cli`.

To learn more, run the command again with --verbose.
codee@ryzen3:~$ free -h
              total        used        free      shared  buff/cache   available
Mem:           3.4G        1.5G        934M         55M        1.0G        1.6G
Swap:          2.0G        2.5M        2.0G

codee@ryzen3:~/rust/ruster$ cargo -V
cargo 1.33.0 (f099fe94b 2019-02-12)

codee@ryzen3:~/rust/ruster$ rustup -V
rustup 1.17.0 (069c88ed6 2019-03-05)

codee@ryzen3:~/rust/ruster$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

You're missing the postgres library :) I'm not 100% sure, but the
postgresql or postgresql-devel should contain what you are looking for.

On Wed, 3 Apr 2019, 06:33 Ace Besmonte, notifications@github.com wrote:

I have different logs for installing:

codee@ryzen3:~$ cargo install diesel_cli --no-default-features --features postgres
Updating crates.io index
Installing diesel_cli v1.4.0
Compiling proc-macro2 v0.4.27
Compiling cc v1.0.34
Compiling unicode-xid v0.1.0
Compiling libc v0.2.51
Compiling syn v0.15.30
Compiling memchr v2.2.0
Compiling autocfg v0.1.2
Compiling num-traits v0.2.6
Compiling pq-sys v0.4.6
Compiling byteorder v1.3.1
Compiling unicode-xid v0.0.4
Compiling rand_core v0.4.0
Compiling ucd-util v0.1.3
Compiling cfg-if v0.1.7
Compiling smallvec v0.6.9
Compiling quote v0.3.15
Compiling regex v0.2.11
Compiling num-integer v0.1.39
Compiling lazy_static v1.3.0
Compiling serde v1.0.89
Compiling matches v0.1.8
Compiling rustc-demangle v0.1.13
Compiling utf8-ranges v1.0.2
Compiling unicode-width v0.1.5
Compiling bitflags v1.0.4
Compiling ansi_term v0.11.0
Compiling remove_dir_all v0.5.1
Compiling percent-encoding v1.0.1
Compiling strsim v0.7.0
Compiling vec_map v0.8.1
Compiling rand_chacha v0.1.1
Compiling backtrace v0.3.14
Compiling rand_pcg v0.1.2
Compiling rand v0.6.5
Compiling synom v0.11.3
Compiling backtrace-sys v0.1.28
Compiling regex-syntax v0.5.6
Compiling rand_core v0.3.1
Compiling rand_jitter v0.1.3
Compiling unicode-normalization v0.1.8
Compiling thread_local v0.3.6
Compiling unicode-bidi v0.3.4
Compiling textwrap v0.10.0
Compiling rand_isaac v0.1.1
Compiling rand_xorshift v0.1.1
Compiling rand_hc v0.1.0
Compiling syn v0.11.11
Compiling rand_os v0.1.3
Compiling time v0.1.42
Compiling atty v0.2.11
Compiling aho-corasick v0.6.10
Compiling idna v0.1.5
Compiling quote v0.6.11
Compiling clap v2.32.0
Compiling chrono v0.4.6
Compiling url v1.7.2
Compiling derive-error-chain v0.10.1
Compiling tempfile v3.0.7
Compiling error-chain v0.10.0
Compiling diesel_derives v1.4.0
Compiling serde_derive v1.0.89
Compiling dotenv v0.10.1
Compiling diesel v1.4.2
Compiling toml v0.4.10
Compiling migrations_internals v1.4.0
Compiling diesel_cli v1.4.0
error: linking with cc failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.0.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.1.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.10.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.11.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.12.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.13.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.14.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.15.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.2.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.3.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.4.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.5.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.6.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.7.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.8.rcgu.o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.diesel.cx7gqjdg-cgu.9.rcgu.o" "-o" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b" "/tmp/cargo-installtBXuAW/release/deps/diesel-aa9646480af8333b.3zww99mfmc53sgk6.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installtBXuAW/release/deps" "-L" "/tmp/cargo-installtBXuAW/release/build/backtrace-sys-c3fdfda3286dfeb7/out" "-L" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/cargo-installtBXuAW/release/deps/liburl-b0a144ac385c92d3.rlib" "/tmp/cargo-installtBXuAW/release/deps/libpercent_encoding-3c54b6b409caf9cc.rlib" "/tmp/cargo-installtBXuAW/release/deps/libidna-8736338779bf71a6.rlib" "/tmp/cargo-installtBXuAW/release/deps/libunicode_normalization-c6c83c4b4f063d60.rlib" "/tmp/cargo-installtBXuAW/release/deps/libsmallvec-f5b9c1662b5eedcd.rlib" "/tmp/cargo-installtBXuAW/release/deps/libunicode_bidi-9a7d8afa5f91ca2e.rlib" "/tmp/cargo-installtBXuAW/release/deps/libmatches-4480108f1ef64f65.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtoml-e1779f25d4ccb3a8.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtempfile-e1afe99710f5b97d.rlib" "/tmp/cargo-installtBXuAW/release/deps/libremove_dir_all-8c47dd167514aa2e.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand-51d51249a9835f8e.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_xorshift-7492bf1def6bb26a.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_pcg-0730bee4a5430f55.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_hc-b2b5c08a30538d30.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_chacha-7f5afa7cd2715e2a.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_isaac-e6de3b95fae26f23.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_core-2f4b230967d80f93.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_os-67c51dd38350d3e6.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_jitter-ed66d9521fa95bc6.rlib" "/tmp/cargo-installtBXuAW/release/deps/librand_core-788567e395963788.rlib" "/tmp/cargo-installtBXuAW/release/deps/libserde-fc46b82dbb3519a8.rlib" "/tmp/cargo-installtBXuAW/release/deps/libmigrations_internals-66c2af111d89a5db.rlib" "/tmp/cargo-installtBXuAW/release/deps/libdotenv-904ec4bce7ead678.rlib" "/tmp/cargo-installtBXuAW/release/deps/libregex-470f40897bce1347.rlib" "/tmp/cargo-installtBXuAW/release/deps/libutf8_ranges-e48bfb689e611da0.rlib" "/tmp/cargo-installtBXuAW/release/deps/libregex_syntax-d79d68dd5363fdb5.rlib" "/tmp/cargo-installtBXuAW/release/deps/libucd_util-57f7989c5c07c423.rlib" "/tmp/cargo-installtBXuAW/release/deps/libthread_local-092f9d6ccc082d3d.rlib" "/tmp/cargo-installtBXuAW/release/deps/liblazy_static-9967fb62f02a664b.rlib" "/tmp/cargo-installtBXuAW/release/deps/libaho_corasick-3f7aa807f2ff99de.rlib" "/tmp/cargo-installtBXuAW/release/deps/libmemchr-9f0cf6e5a1322d53.rlib" "/tmp/cargo-installtBXuAW/release/deps/liberror_chain-4c3078047c81b35a.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbacktrace-fedf2d4773fd9cb2.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbacktrace_sys-e741afdabdbbcaa4.rlib" "/tmp/cargo-installtBXuAW/release/deps/librustc_demangle-1027d023ad5a58c5.rlib" "/tmp/cargo-installtBXuAW/release/deps/libcfg_if-41f3583e7e446002.rlib" "/tmp/cargo-installtBXuAW/release/deps/libdiesel-2af2d07268ecdea1.rlib" "/tmp/cargo-installtBXuAW/release/deps/libpq_sys-3d4f6e98cd847220.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbyteorder-602cc862f607f690.rlib" "/tmp/cargo-installtBXuAW/release/deps/libclap-83e2a2053c2ad0de.rlib" "/tmp/cargo-installtBXuAW/release/deps/libvec_map-699714b9fbf3bb2a.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtextwrap-611a573871a5a9c3.rlib" "/tmp/cargo-installtBXuAW/release/deps/libunicode_width-c67327480cb3edbd.rlib" "/tmp/cargo-installtBXuAW/release/deps/libstrsim-1cd684f3bcd7452e.rlib" "/tmp/cargo-installtBXuAW/release/deps/libbitflags-21cb679825a027ab.rlib" "/tmp/cargo-installtBXuAW/release/deps/libatty-61f418d426de34d8.rlib" "/tmp/cargo-installtBXuAW/release/deps/libansi_term-5d02bf49ab7e1d32.rlib" "/tmp/cargo-installtBXuAW/release/deps/libchrono-eb43d05533cd8b76.rlib" "/tmp/cargo-installtBXuAW/release/deps/libnum_integer-b05f5d4e9600144f.rlib" "/tmp/cargo-installtBXuAW/release/deps/libnum_traits-3a019df363a5f909.rlib" "/tmp/cargo-installtBXuAW/release/deps/libtime-c07689338d581aaf.rlib" "/tmp/cargo-installtBXuAW/release/deps/liblibc-1dc47802d96d2bda.rlib" "-Wl,--start-group" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e39317eb74365d3c.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4d55a38564aae54a.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-f8521075e248b627.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-7c91ffdc8da860d3.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0ad27b9879d551d3.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-588f18eae3ea58be.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4ebf5caee903d98f.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-8895b32baedb08c6.rlib" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-6a9d233d01acc350.rlib" "-Wl,--end-group" "/home/codee/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-851bb3b5f6c4db49.rlib" "-Wl,-Bdynamic" "-lpq" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
= 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.0, intermediate artifacts can be found at /tmp/cargo-installtBXuAW

Caused by:
Could not compile diesel_cli.

To learn more, run the command again with --verbose.
codee@ryzen3:~$ free -h
total used free shared buff/cache available
Mem: 3.4G 1.5G 934M 55M 1.0G 1.6G
Swap: 2.0G 2.5M 2.0G

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/diesel-rs/diesel/issues/2026#issuecomment-479336109,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMxqZ7BvHbPjwIEM5vs9D5uFECEil3Dks5vdC8WgaJpZM4cWcVi
.

i install

sudo apt install libpq-dev

and it works. Thanks Guys!

Had the same issue today. I use arch/manjaro. I installed

libmariadbclient postgresql-libs sqlite

I have the same error on my VPS with 521M RAM when compiling diesel_cli, and I am sure I have installed libpq-dev and other dependencies. After suffering for a few days, I fix this error with creating a 2G swapfile to alleviate some of pressure on RAM, and diesel_cli works perfectly now.

@ramsayleung answer helped me! Here are the steps followed to successfully install the cli app

sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo chmod 600 /swapfile

Check a file was made

ls -l /swapfile 

# OUTPUT
# -rw------- 1 root root 2147483648 Jun 26 15:29 /swapfile

Setup file as swap

sudo mkswap /swapfile
sudo swapon /swapfile

Check that it worked

swapon -s

# OUTPUT
# Filename                      Type        Size    Used    Priority
# /swapfile                                 file        2097148 22016   -2

Lastly setup swap to work on boot

sudo nano etc/fstab

# ADD LINES
# /swapfile swap swap defaults 0 0

Now install Diesel!

cargo install diesel_cli

# OUTPUT
# Compiling diesel_cli v1.4.0
# Finished release [optimized] target(s) in 7m 51s
# Installing /home/ec2-user/.cargo/bin/diesel

woooo profit

This issue is not relevant to me anymore and it's good to see there is a way to fix it (besides cross-compiling it in another machine and uploading it).

It would be nice to see the swap file tip somewhere in the docs. But since this issue can be googled I'm closing it.

Feel free to re-open if this is a good way to help users fix the problem, although I feel it will attract a bunch of people with different problems (dependencies and such), just like it happened.

For Googlers;

You should build for your database, like:

# one of this
cargo install diesel_cli --no-default-features --features sqlite
cargo install diesel_cli --no-default-features --features postgres
cargo install diesel_cli --no-default-features --features mysql

And make sure these are installed on your system.

but what libpq should I have when I build on amd64-glibc host for arm7hf-musl?
I try libpq-dev:armhf, I try libpq build for arm with musl. Both cases error during linking.

Hit this page looking for a different issue:

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

Caused by:
  cannot produce proc-macro for `derive-error-chain v0.10.1` as the target `x86_64-unknown-linux-musl` does not support these crate types

In case someone is trapped by the same error, my build worked using the flags commented at rust-lang/rust#59302
i.e.: RUSTFLAGS="-C target-feature=-crt-static" cargo install diesel_cli

Might be the workaround for you, @iav if that's the linking issue you are facing as well.

yes, I use already

[target.aarch64-unknown-linux-musl]
rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"]

and it works for arm64. Sad but it not enough for [target.armv7-unknown-linux-musleabihf]

Can someone help me?

error: linking with cc failed: exit code: 1
|
= note: "cc" "-m64" "-L" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.0.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.1.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.10.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.11.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.12.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.13.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.14.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.15.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.2.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.3.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.4.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.5.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.6.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.7.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.8.rcgu.o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.diesel.2idgklrp-cgu.9.rcgu.o" "-o" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/diesel-e9097d53eaeb13aa.3ai3evc17gkutf9k.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps" "-L" "/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/build/backtrace-sys-49a6e7c5c9f618aa/out" "-L" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libtoml-e3cc4b40d41a0444.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libtempfile-510e778773254b70.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/librand-f5f1d6bc1aedfbc3.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/librand_chacha-d934a2cc7ca82d02.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libc2_chacha-136be31c8538e703.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libppv_lite86-2e572a0977e5c2f0.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/librand_core-cc84669982c5c8e9.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libgetrandom-1d6378b6e15830f7.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libremove_dir_all-6763ecda6252c108.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libserde-96a23fbeb0c44dba.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libmigrations_internals-5e61578709129077.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libdotenv-492dda45cbbfae76.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libregex-35178cb32d3ed0e6.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libutf8_ranges-da30a6dba672a6d4.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libregex_syntax-9d3f3d7dfa4111c7.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libucd_util-a64765106c33927c.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libthread_local-328c8c58e284926f.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/liblazy_static-db7f3a3ee8fcf0f4.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libaho_corasick-28fcf37ea2bedcd2.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libmemchr-e9dc89dc5f6e5a3f.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/liberror_chain-c2c0d4ed8f8edcaa.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libbacktrace-2bb6268e3b19f0a7.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libbacktrace_sys-8a54a046bd067473.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libcfg_if-daf7683140ea3820.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/librustc_demangle-95b10b3f96a66e5c.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libdiesel-bda3e0590e784978.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/liburl-f76baab95aba6e01.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libpercent_encoding-41ba35730b15c3e9.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libidna-344234676f91c622.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libunicode_normalization-fccddfd9fcbc58e4.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libsmallvec-f89302716b1321b8.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libunicode_bidi-ba232e2b7775258e.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libmatches-2bfd305d88de7d49.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libmysqlclient_sys-97d2c73613dbf0ea.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libbyteorder-23e31735f071c76d.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libclap-76a693bff7c5d04e.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libvec_map-d5cad80099fb89ef.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libtextwrap-4fd5efbfb3b51872.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libunicode_width-d0c29b2632674e9a.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libstrsim-c6674c97193b853f.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libbitflags-560f1768ae5225ca.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libatty-1c68b8df8be50a5d.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libansi_term-7a827bfb2c5c5fb3.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libchrono-c37f2b2b7ec9e28d.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libnum_integer-83d0e385ed5f2f15.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libnum_traits-556040548bd5b81c.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/libtime-4fd210fbfcd59c0e.rlib" "/private/var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur/release/deps/liblibc-3c44e8e36398be40.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-ec578e0d01ad5d6e.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-5412e5af11009a97.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-03db0718fbd4a443.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-8df90fdde44531fa.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace-080b75c76cf389d3.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace_sys-954947c96c071ed1.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-9a1775bac6aabe20.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-71147793b4cdc412.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-9fc81eecc6136c9a.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-4b64712313317864.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-1bcd644d1289b2fb.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-16c65b3b16ee989d.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-7dd67903be10326a.rlib" "/Users/weldisson.a.silva/.rustup/toolchains/1.39.0-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-b5923fb6eca9603a.rlib" "-lmysqlclient" "-lSystem" "-lresolv" "-lc" "-lm"
= note: ld: library not found for -lmysqlclient
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: failed to compile diesel_cli v1.4.0, intermediate artifacts can be found at /var/folders/3s/22jvggx95yxd7t6mjwdskm7m0000gn/T/cargo-install7jO1ur

Caused by:
could not compile diesel_cli.

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

I had to install the proper things and then run a more specific CLI bundle.

First I had to install mysql-server and get it set up. Then:

sudo apt install libpq-dev libmysqlclient-dev
cargo install diesel_cli --no-default-features --features postgres

@google-mac and @WELDISSON That's a issue tracker. It's meant for tracking bugs and feature requests, not for answering questions. Please use our gitter channel or our forum for questions.
(And yes, you need to install the requested native dependencies for certain backends. Which exactly are dependent on your platform and which features you've enabled/disabled.)

@weiznich, I would consider this still on the topic of the issue - I think we all know what an issue tracker is.

The docs do not provide any insight into what packages are needed. I guess it kind of assumes that all diesel users are system admins.

My answer was to provide help to others who visit this issue because they currently won't find it in the docs. 😊

I am creating CRUD for using sqlite
When i did cargo install diesel_cli --no-default-features --features sqlite
I got this error

`note: /usr/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status

error: aborting due to previous error

error: failed to compile diesel_cli v1.4.0, intermediate artifacts can be found at /tmp/cargo-installoNhOKu

How to link library for sqlite?
I have sqlite3 installed in my system

@IamSaquib

If you are on ubuntu, try:

sudo apt install -y libdbus-1-dev libsqlite3-dev

If you are on alpine, the equivalent package of libpq-dev is postgresql-dev

Was this page helpful?
0 / 5 - 0 ratings