【发布时间】:2019-07-24 22:29:29
【问题描述】:
我一直在尝试使用 cargo install diesel_cli 安装 Rust Diesel CLI 工具,但安装失败并出现链接错误
ld: library not found for -lmysqlclient
clang: error: linker command failed with exit code 1
(use -v to see invocation)
我使用 Homebrew 安装了 MySQL 客户端:brew install mysql-client。在安装过程中,我收到以下警告:
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:
export LDFLAGS="-L/usr/local/opt/mysql-client/lib"
export CPPFLAGS="-I/usr/local/opt/mysql-client/include”
我在警告消息中设置了PATH 和标志,但在尝试安装diesel-cli 工具时仍然出现上述链接错误。我不熟悉如何在 Rust 中进行链接 - 我需要在这里执行额外的步骤来直接链接 mysqlclient 吗?
【问题讨论】:
标签: mysql macos rust linker-errors