Does diesel requires mysql and sqlite to be installed?

Viewed 440

I'm doing RUN cargo install diesel_cli in my docker image, and I get:

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

only postgres is installed.

Do I really need to install sqlite3 and mysqlclient even though I'm not going to use then? I want to keep my container small.

1 Answers

Check your [dependencies] as for Postgres only:

[dependencies]
diesel = { version = "1.4.6", features = ["postgres"] }

Note you have to specify features and explicitly remove mysql and sqlite which are present by default.

For a cargo install the same principle should apply but you need to add --no-default-features to turn off defaults:

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