首页 文章

错误:安装mysql时出错:错误:无法构建gem原生扩展

提问于
浏览
4

我按照“http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/”来设置Ruby on rails app和mysql server 5.1之间的连接

所以当我使用以下命令安装mysql gem时:

gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32

所以我收到以下错误日志:

暂时增强PATH以包含DevKit ...构建本机扩展 . 这可能需要一段时间...错误:安装mysql时出错:错误:无法构建gem原生扩展 . C:/Ruby187/bin/ruby.exe extconf.rb --with-mysql-dir = C:/ mysql-connector-c
-noinstall-6.0.2-win32检查-llibmysql中的main()... no * extconf.rb失败*由于某些原因无法创建Makefile,可能缺少必要的库和/或头文件 . 检查mkmf.log文件以获取更多详细信息 . 您可能需要配置选项 . 提供的配置选项: - with-opt-dir --without-opt-dir --with-opt-include --without-opt-include = $
/ include --with-opt-lib - without-opt-lib = $ / lib --with-make-prog --without-make-prog --srcdir = . --curdir --ruby = C:/ Ruby187 / bin / ruby --with-mysql-dir --with-mysql-include --without-mysql-include = $ / include --with-mysql -lib --without-mysql-lib = $ / lib --with-libmysqllib --without-libmysqllib Gem文件将保持安装在C:/Ruby187/lib/ruby/gems/1.8/gems/mysql -2.9.1进行检查 . 结果记录到C:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.9.1/ext/mysql_api/ge m_make.out

额外信息:Ruby版本1.8.7 Windows 7 64位Mysql版本5.1

3 回答

  • 4

    使用railsinstaller安装rails更容易 .

  • 2
    • 下载mysql / C连接器Zip文件 .

    • 解压缩到特定文件夹说 C: drive .

    • 复制 libmySQL.dll from mysql/C 连接器Zip文件 .

    • 尝试此命令 gem install mysql --platform=ruby - --with- mysql-lib=C:\mysql-C-connector\lib --with- mysql-include=c:\mysql-C-connector\include

  • 0

    请先安装Devkit
    https://github.com/oneclick/rubyinstaller/wiki/development-kit
    http://rubyinstaller.org/downloads/

    按照github repo的说明,它会正常工作 .

相关问题