簡體   English   中英

由於缺少libmysql,在Windows上安裝mysql-2.9.0 gem失敗

[英]Installing mysql-2.9.0 gem on Windows fails due to lack of libmysql

我正在嘗試在Windows Server 2003上安裝Redmine 2.1.4。為了工作,我需要安裝activerecord-mysql-adapter gem,而這似乎依賴於mysql-2.9.0.gem 我從rubygems下載后者並執行:

gem install mysql-2.9.0.gem

它給出了以下輸出:

C:\>gem install mysql-2.9.0.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing mysql-2.9.0.gem:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe extconf.rb
checking for main() in -llibmysql... 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
        --without-mysql-lib=${mysql-dir}/lib
        --with-libmysqllib
        --without-libmysqllib


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql-2.9.0 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql-2.9.0/ext/mysql_api/gem_make.out

我猜,有一種可能性是我缺少MySQL C Connector庫。 我從http://dev.mysql.com/downloads/connector/c下載了mysql-connector-c-6.0.2-win32.msimysql-connector-c-6.0.2-win32-vs2005.msi / ,但兩個安裝程序都退出: 在此輸入圖像描述

我也嘗試將C:\\Program Files\\MySQL\\MySQL Server 5.1\\lib\\debug\\libmysql.dll C:\\Ruby193\\binC:\\Ruby193\\bin ,但它也沒有解決mysql-2.9.0.gem的安裝問題。

我還能嘗試什么?

編輯

從我認為的日志中,Ruby正在尋找下的文件,驚喜,驚喜,$ RUBY_HOME \\ lib,而不是$ RUBY_HOME \\ bin,正如問題中提到的一些來源中所找到的那樣。 所以將libmysql從$ MySQL_HOME \\ lib移動到$ RUBY_HOME \\ lib有點幫助,但現在Ruby找不到其他的lib和頭文件了。 所以我猜,我需要使用如下選項:

C:\>gem install mysql-2.9.0.gem --platform=ruby --with-opt-lib="C:/Program Files/MySQL/MySQL Server 5.1/lib" --with-opt-include="C:/Program Files/MySQL/MySQL Server 5.1/include"

這也不會起作用(可能是因為路徑中的空格)。

嘗試從http://dev.mysql.com/downloads/connector/c/沒有安裝程序版本的連接器,並提取根文件夾中的內容或沒有任何空間的文件夾路徑,然后嘗試安裝mysql gem

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

我已經發布了帶有rubyx86-mingw32預編譯二進制文件的mysql gem版本2.9.0。

如果讓RubyGems確定合適的平台,它將自動為您安裝x86-mingw32平台gem,這將避免編譯過程。

安裝完成后,它會顯示一組說明,指示您下載MySQL Connector / C並將其DLL放在正確的位置:

C:\Users\Luis>gem install mysql
Fetching: mysql-2.9.0-x86-mingw32.gem (100%)

======================================================================================================

  You've installed the binary version of mysql.
  It was built using MySQL Connector/C version 6.0.2.
  It's recommended to use the exact same version to avoid potential issues.

  At the time of building this gem, the necessary DLL files where available
  in the following URL:

  http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

  You can put the lib\libmysql.dll available in this package to your Ruby bin directory.
  E.g. C:\Ruby\bin

======================================================================================================

Successfully installed mysql-2.9.0-x86-mingw32
1 gem installed

如果您只需要連接到已經運行的MySQL版本,則無需下載或安裝MySQL。

RubyGems和Bundler都會自動檢測正確的平台並安裝正確的預編譯二進制文件,而無需自己編譯。

如果您在代理后面,請使用gem install --http-proxy參數(請參閱幫助)或設置HTTP_PROXY環境變量。

希望有所幫助。

暫無
暫無

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

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