Hi there, I have been trying to install the rust diesel cli tool, using cargo install diesel_cli, but the installation fails with a linking error
ld: library not found for -lmysqlclient
clang: error: linker command failed with exit code 1
(use -v to see invocation)
I installed mysql client using home-brew : brew install mysql-client. During installation I got the following warning:
mysql-client is keg-only, which means it was not symlinked into /usr/local,
because conflicts with mysql.
If you need to have mysql-client first in your PATH run:
echo ‘export PATH="/usr/local/opt/mysql-client/bin:$PATH"’ >> ~/.bash_profile
For compilers to find mysql-client you may need to set:
I set the PATH and flags as in that warning message, but I still get the above linking error when trying to install the diesel-cli tool. I am pretty unfamiliar with how to do linking correctly in Rust (and in general tbh)- are there extra steps I need to do here to link mysqlclient directly?
Many Thanks in advance!
EDIT: I have managed to do this using Rust Flags, by running
RUSTFLAGS="-L/usr/local/opt/mysql-client/lib" cargo install diesel_cli. Would still be interested in knowing whether there are other ways of doing this.