2012-10-01 90 views
3

我已經有很長一段時間了rails的問題,我嘗試了很多我在這裏找到的類似問題的答案但雖然其中一些有效的一些錯誤,我一直堅持,並不能解決這個問題,我嘗試了大多數解決方案,我發現了類似的問題,最後決定問自己,這個錯誤只發生在爲這個特定的項目啓動服務器時,而在服務器上爲一個新的空軌項目正常啓動:圖書館沒有加載:/usr/local/mysql/lib/libmysqlclient.18.dylib(LoadError)

$ rails server 
/Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': dlopen(/Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.18.dylib (LoadError) 
Referenced from: /Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 
Reason: no suitable image found. Did find: 
/usr/local/mysql/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture 
/usr/local/mysql/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture 
/usr/lib/libmysqlclient.18.dylib: mach-o, but wrong architecture - /Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle 
from /Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>' 
from /Users/celorisoli/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require' 
from /Users/celorisoli/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require' 
from /Users/celorisoli/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each' 
from /Users/celorisoli/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require' 
from /Users/celorisoli/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each' 
from /Users/celorisoli/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require' 
from /Users/celorisoli/.rvm/gems/[email protected]/gems/bundler-1.2.1/lib/bundler.rb:128:in `require' 
from /Users/celorisoli/logbook/config/application.rb:7:in `<top (required)>' 
from /Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require' 
from /Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>' 
from /Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap' 
from /Users/celorisoli/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in `<main>' 

大多數的回答可以幫助各國「沒有找到圖片」問題,但在這裏的錯誤是:

Reason: no suitable image found. Did find: 
+0

http://www.blog.bridgeutopiaweb.com/post/how-to-fix-mysql-load-issues-on-mac-os-x/有幫助嗎? – PiLHA

+0

我已嘗試之前它返回的鏈接install_name的兩個實例: install_name_tool:無法打開文件:在/ usr/local/bin目錄/搜索(沒有這樣的文件或目錄) 或 install_name_tool :無法打開文件:/ usr/local/bin/indexer(沒有這樣的文件或目錄) –

+0

現在鏈接http://c.kat.pe/post/how-to-fix-mysql-load-issues- on-mac-os-x/...我建議通過自制軟件安裝MySQL。 – kgpdeveloper

回答

3

您需要查找libmysqlclient.18.dylib實際在您的機器上的位置,並使用正確的路徑更新該軟件包。

例如,我的錯誤信息是:

/Users/rbotzer/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require。 rb:36: `require': dlopen(/Users/rbotzer/.rvm/gems/ruby-1.9.3-p392/gems/mysql-2.9.1/lib/mysql/mysql_api.bundle, 9) :庫未加載:libmysqlclient.18.dylib(LoadError)

我所在libmysqlclient.18.dylib在/usr/local/mysql-5.6.16-osx10.7-x86_64/lib/libmysqlclient.18。 dylib

現在更新包:

須藤install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql-5.6.16-osx10.7-x86_64/lib/libmysqlclient.18.dylib 〜/ .rvm /寶石/紅寶石1.9.3-P392 /寶石/ MySQL的-2.9.1/lib中/ MySQL的/ mysql_api.bundle

這解決了這個問題對我來說。