簡體   English   中英

在mac上安裝帶有rails3的mysql2 gem真的很奇怪

[英]Really weird error installing mysql2 gem with rails3 on mac

我收到此錯誤:

構建原生擴展。 這可能需要一段時間......

ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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.

我在這里嘗試了一切但我仍然得到錯誤。 出於某種原因,當我運行locate mysql_config這是我得到的結果:

/Applications/MAMP/Library/bin/mysql_config /Applications/MAMP/Library/share/man/man1/mysql_config.1

我嘗試使用每個路徑運行sudo gem install mysql2 -- –with-mysql config=/path/you/identified/above/mysql_config兩次,但我仍然從上面得到錯誤。 我下載了一個新版本的MySql,我有Xcode,但我仍然遇到這些錯誤。 我究竟做錯了什么?

MAMP安裝是你唯一安裝的mysql嗎? 如果你已經從mysql包安裝了它,那么我認為mysql_config將安裝在/ usr / local / bin / mysql_config中,所以你可能想嘗試:

sudo gem install mysql2 - -with-mysql-config == / usr / local / bin / mysql_config

僅供參考,/ Applications / MAMP / Library / share / man / man1 / mysql_config.1路徑顯然是錯誤的。 這指向mysql_config的man文件而不是實際的可執行文件。

可以肯定的是,你確實嘗試過這個嗎? (完全如書面)

sudo gem install mysql2 - -with-mysql-config = / Applications / MAMP / Library / bin / mysql_config

另外,我不確定與MAMP一起打包的mysql是否有你需要的頭文件。 您可能最好從http://dev.mysql.com/downloads/mysql/安裝mysql,然后嘗試安裝您的gem。 在這種情況下,我認為它會起作用。

暫無
暫無

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

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