我正在尝试通过
安装mysql gemsudo gem install mysql --version 2.7
但是,我收到以下错误:
Building native extensions. This could take a while...
...........
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** 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.
有什么想法吗?
答案 0 :(得分:2)
尝试的事情:
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
当然使用mysql_config所在的路径。如果您已经安装了mysql客户端,那么mysql_config将会存在
gem install mysql -- \
--with-mysql-include=/usr/include/mysql \
--with-mysql-lib=/usr/lib/mysql
使用lib和header所在的路径用于mysql。