[英]Can't Install MySQL2 0.3.16 gem on Ruby
我在Ruby上安装mysql2 gem时遇到了很多问题,我尝试了很多指南,但是似乎没有任何效果。这是我尝试安装它时出现的错误,没有任何其他命令。
C:\Users\Julián>gem install mysql2 --no-rdoc --no-ri
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
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... no
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... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby200-x64/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mygcclib
--without-mygcclib
--with-mysqlclientlib
--without-mysqlclientlib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql
2-0.3.16 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.
0/mysql2-0.3.16/gem_make.out
我真的很沮丧,我试图在这里找到解决方案,但找不到任何东西。 我尝试安装MySQL连接器并使用-mysql-lib命令进行设置。 请帮忙!
由于您似乎正在使用Windows,因此需要考虑必须安装MYSQL C-Connector
头文件才能使其正常工作
-
您将要使用以下步骤:
- 安装
MYSQL C-Connector
文件(路径中没有空格)- 再次安装MYSQL2 gem(具有正确的路径引用)
- 将
lbmysql.dll
复制到您的ruby/bin
文件夹
首先,您需要对MYSQL C连接器文件进行下装:
它必须是32位C连接器
将其安装到没有空格的路径后,可以再次使用mysql2
安装命令,并带有config选项:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector-path"'
之后,您可以将libmysql.dll
从mysql
文件传输到ruby/bin
目录:
首先在终端中执行“ locate mysql_config ”,然后将以下命令中的路径替换为该文件所在的位置。
gem install mysql2 --no-rdoc --no-ri --with-mysql-config = 路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.