簡體   English   中英

錯誤:安裝mysql時出錯:錯誤:無法構建gem本機擴展

[英]ERROR: Error installing mysql: ERROR: Failed to build gem native extension

我遵循“ http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/ ”來設置Ruby之間的連接。 Rails應用程序和mysql服務器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()...否* extconf.rb失敗*由於某種原因(可能缺少必需的庫和/或頭文件)而無法創建Makefile。 檢查mkmf.log文件以獲取更多詳細信息。 您可能需要配置選項。

提供的配置選項:
--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
--with-make-prog
--srcdir =。
--curdir
--ruby = C:/ Ruby187 / bin / ruby
--with-mysql-dir
--with-mysql-include
--without-mysql-include = $ {mysql-dir} / include
--with-mysql-lib
--without-mysql-lib = $ {mysql-dir} / lib
--with-libmysqllib
--without-libmysqllib

寶石文件將保留安裝在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

  1. 下載mysql / C連接器的Zip文件。

  2. 解壓縮到特定文件夾,說C: drive

  3. libmySQL.dll from mysql/C連接器的Zip文件復制libmySQL.dll from mysql/C

  4. 試試這個命令gem install mysql --platform=ruby --- gem install mysql --platform=ruby mysql-lib=C:\\mysql-C-connector\\lib --with- mysql-include=c:\\mysql-C-connector\\include

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

按照github repo的說明進行操作,即可正常工作。

使用railsinstaller安裝導軌會更容易。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM