3

Compiling diesel_cli on Ubuntu 16.04, I'm unable to find which package I should install to get rid if the message

~$ cargo install diesel_cli
    Updating crates.io index
  Installing diesel_cli v1.4.0
...
   Compiling toml v0.4.10
   Compiling diesel_cli v1.4.0
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed"
....
note: ld: library not found for -lmysqlclient

There was also another dependency, on libpq, but that was solved installing postgresql. Of course I have installed more or less all what I've found related to mysql, indeed the mysql crate installs and execute without problems.

My last attempt have been

sudo apt-get install mysql\*

but the problem is not solved. Any hint ?

CapelliC
  • 285

2 Answers2

3

As the error message noted "library not found for -lmysqlclient" As you probably observed, installing mysql doesn't solve. To resolve it, install libmysqlclient-dev:

sudo apt-get install libmysqlclient-dev

For others encountering a similar issue executing "cargo install diesel_cli", you may also want to add:

sudo apt install libpq-dev 
sudo apt install libmariadbclient-dev-compat
sudo apt install libsqlite3-dev 
Nditah
  • 146
  • 4
0

Thanks to Nditah for

sudo apt install libpq-dev

Was getting this error: = note: /usr/bin/ld: cannot find -lpq

Works for postgres now.

Running cargo install diesel_cli --no-default-features --features postgres with no issues now.

Tea Zulo
  • 101