我尝试使用以下命令安装mysql
gem install mysql2 -v '0.3.18'但是,我得到了以下错误
Fetching: mysql2-0.3.18.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/home/jophy/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20170221-7481-38xom2.rb extconf.rb
extconf.rb failed
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.当我打开mkmf.log时,可以找到以下错误:
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status发布于 2017-02-21 17:37:43
正如@steeldriver在他的评论中提到的那样,您需要安装libmysqlclient-dev包,这是所有当前支持的Ubuntu版本都可以使用的Ubuntu,可以通过Z校精确地安装,也可以通过软件中心安装,也可以通过命令sudo apt-get install libmysqlclient-dev从CLI (终端)安装。
资料来源:
https://askubuntu.com/questions/885840
复制相似问题