我一直在試圖弄清楚如何讓OS X Lion與XAMPP安裝的MySQL一起使用在rails2中的mysql2 gem。OS X Lion with xampp + rails + mysql2 gem
這是我已經試過:
- 安裝了XAMPP開發套件
- 安裝MYSQL5服務器與兩個端口和啤酒。這兩個我現在卸載。因爲它沒有解決問題。從DMG文件
- 安裝MYSQL5社區版。現在卸載,因爲它沒有解決問題。
- 下載MYSQL5社區版的32位版本的焦油。提取的文件夾「在/ var/mysql的」
這裏是我正在試圖把它安裝了命令:
gem install mysql2 -- --with-mysql-dir=/var/mysql --with-mysql-include=
/var/mysql/include --with-mysql-lib=/var/mysql/lib --with-mysql-config=
/Applications/XAMPP/xamppfiles/bin/mysql_config
我不知如何得到這個工作。我能想到的唯一的事情是我不知道如何正確指向目錄。我嘗試從with-mysql-include,with-mysql-dir和with-mysql-lib配置選項中刪除/ include /,/ mysql /和/ lib /。沒有那個運氣。我試過將它們指向XAMPP安裝。還沒有運氣。
返回的錯誤是:
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb --with-mysql-dir=/var/mysql --with-mysql-include=/var/mysql/include --with-mysql-lib=/var/mysql --with-mysql-config=/Applications/XAMPP/xamppfiles/bin/mysql_config
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/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
嗯。那麼做到了!我不知道爲什麼它沒有這樣做......謝謝! – SB2017
將評論移到答案中,因爲它解決了問題。 – mrlee