2013-07-11 173 views
0

我已經瀏覽了stackoverflow上的多個問題,他們都給出了不同的解決方案。我git克隆了一個rails項目,運行了bundle install,並在rvm中使用1.9.3 ruby​​創建了一個新的gemset,並且使用bundle install命令也可以安裝3.2.13。在過去,我通過使用本指南解決了這個問題,http://www.randomactsofsentience.com/2013/05/gem-install-mysql2-missing-mysqlh-on-os.html。我無法在用戶/本地找到mysql文件夾,指南說我需要編輯一個文件,並刪除一些行來解決mysql.h缺失的問題。該文件不再存在?我找不到它?也許我缺少依賴關係,但我發現這些依賴關係的Linux安裝方式?也許我需要安裝mysql5.5而不是最新版本,但不知道如何指定?這其中的一個將爲我解決這個問題?MySQL軟件包安裝

Installing mysql2 (0.3.11) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

    /Users/judyngai/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes 
checking for rb_wait_for_single_fd()... yes 
checking for mysql.h... no 
checking for mysql/mysql.h... no 
----- 
mysql.h is missing. please check your installation of mysql and try again. 
----- 
*** 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 
    --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=/Users/judyngai/.rvm/rubies/ruby-1.9.3-p429/bin/ruby 
    --with-mysql-config 
    --without-mysql-config 


Gem files will remain installed in /Users/judyngai/.rvm/gems/[email protected] /gems/mysql2-0.3.11 for inspection. 
Results logged to /Users/judyngai/.rvm/gems/[email protected]/gems/mysql2-0.3.11/ext/mysql2/gem_make.out 

An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. 
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling. 

回答

1

您需要設置MySQL的開發頭文件(因此,.h文件擴展名)第一包/寶石才能建立自己的原生MySQL擴展。你在哪個操作系統上?所以我可以延長我的答案...

E.g.在debian上,它將是:apt-get install libmysqlclient-dev(在其他系統上,它可能會被命名爲不同,如mysql-devel)。如果您在OSX上,那麼bundle install problem: mysql.h is missing上的信息可能會對您有所幫助。對於windows,這可能會有所幫助:Missing mysql.h and trying to find mysql-devel

+0

mac osx 10.8.4,我還沒有看到答案。現在會做 – Jngai1297

+0

是的我知道了,原來指導是正確的,但我錯誤的路徑到mysql_config文件,感謝您的幫助 – Jngai1297