首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装mysql2 gem

安装mysql2 gem
EN

Stack Overflow用户
提问于 2014-06-30 19:52:40
回答 1查看 3.9K关注 0票数 1

我已经尝试安装MySQL2GEM来开始构建我的rails应用程序。我有Rails 4.0.4和Ruby1.9.3p545。经过几天的努力,我也得到了同样的错误。我再次尝试安装mysql 32位版本,以确保我有正确的连接器版本,将我的libmysql.dll和libmysql.lib移到ruby/bin文件夹中,并尝试了其他几种使其工作的方法,这些方法都是我在网上找到的。他们都没有为我工作过。下面是我所拥有的。我将感谢任何帮助,让我最终安装mysql2创业板。

代码语言:javascript
复制
PS C:\Users\pc> gem install mysql2 --no-rdoc --no-ri -- '--with-mysql-lib="C:\Program Files\MySQL\
.6\lib\" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.6\include\"'
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib=C:\Program Files\MySQL\MySQL Server 5.6\lib" --with-mys
Program Files\MySQL\MySQL Server 5.6\include"'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe extconf.rb --with-mysql-lib=C:\Program Files\MySQL\MySQL Server 5.6\lib" --wit
e=C:\Program Files\MySQL\MySQL Server 5.6\include"
checking for ruby/thread.h... no
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:/Ruby193/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib=${mysql-dir}/lib
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib=${mysql-dir}/lib
        --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:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.16 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/mysql2-0.3.16/gem_make.out 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-30 20:40:38

我们编写了关于如何执行此这里的教程。

--

你正在做的事情有几个问题:

  1. 在路径中不能有任何空格。
  2. 您需要包括MYSQL C-Connector的最新版本。

这对我们来说是可行的:

  • 下载最新的32位版本的MYSQL C-连接器
  • 安装到没有空格的路径
  • 使用以下命令: gem install mysql2 --platform=ruby -- ‘--with-mysql-dir=”C:\mysql-connector-path”’

这应该会正确安装它。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24497938

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档