我有運行Ruby 1.9.2,Rails 3和postgreSQL 8.3的應用程序。它最初是安裝和使用postgreSQL 9.1的,但我卸載了9.1並安裝並更改爲8.3,以確保Heroku共享數據庫設置的兼容性。它運行正常,但這個程序工作時,當我運行一個數據庫升級我得到這個錯誤是不是現在Ruby on Rails/PostgreSQL - 啓動server-libq.5.dylib時出現庫未加載錯誤
現在:
dlopen(/Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: libpq.5.dylib
Referenced from: /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle
Reason: no suitable image found. Did find:
/usr/lib/libpq.5.dylib: no matching architecture in universal wrapper - /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle
當我嘗試運行我得到這個服務器錯誤消息:
/Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg.rb:4:in `require': dlopen(/Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: libpq.5.dylib (LoadError)
Referenced from: /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle
Reason: no suitable image found. Did find:
/usr/lib/libpq.5.dylib: no matching architecture in universal wrapper - /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle
from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg.rb:4:in `<top (required)>'
from /Users/michaeljmccoy/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Users/michaeljmccoy/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/michaeljmccoy/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Users/michaeljmccoy/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
from /Users/michaeljmccoy/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Users/michaeljmccoy/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Users/michaeljmccoy/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/michaeljmccoy/www/mikemccoy/config/application.rb:7:in `<top (required)>'
from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:53:in `require'
from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:50:in `tap'
from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我知道他們是非常相似的錯誤,可能與失蹤路徑有關。但是,當我將路徑添加到我的.profile文件並重新啓動終端窗口時,出現相同的錯誤。
您的'PATH'控制shell查找可執行文件的位置。你的'LD_LIBRARY_PATH'控制shell尋找庫的位置。也就是說,這在我看來像你的pg gem是針對不同於你現在使用的PostgreSQL庫版本編譯的。你可能只需要重新安裝頁面。 – 2012-02-07 19:52:31
我刪除了當前的pg gem,並試圖重新安裝,但是我得到了關於丟失postgres庫的相當常見的錯誤。這是我所看到的: 「檢查pg_config ...是 從/Library/PostgreSQL/8.3/bin/pg_config 檢查的libpq-fe.h使用配置值...是 檢查的libpq/libpq的-fs.h ...是 檢查pg_config_manual.h ...是 在-lpq中檢查PQconnectdb()...否 檢查-llibpq中的PQconnectdb()...否 檢查PQconnectdb() in -lms/libpq ... no 找不到PostgreSQL客戶端庫(libpq) *** extconf.rb失敗*** – 2012-02-10 20:28:09
我記得在過去的某個時間點需要解決這個問題,它相當於必須手動向寶石生成器提供標誌,告訴它在哪裏尋找標題和庫,bu我現在沒有手頭的信息。 – 2012-02-10 22:20:10