【问题标题】:Why is rake aborting because of libpq.5.dylib为什么 rake 由于 libpq.5.dylib 而中止
【发布时间】:2013-10-21 06:01:04
【问题描述】:

我刚刚安装了 PostgreSQLpg gem 用于在 Heroku 上运行 Rails。我跑了

$ rake -T

但由于与“libpq.5.dylib”相关的原因而中止

rake aborted!
dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.13.2/lib/pg_ext.bundle, 9): Library not loaded: libpq.5.dylib
Referenced from: /Library/Ruby/Gems/1.8/gems/pg-0.13.2/lib/pg_ext.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/pg-0.13.2/lib/pg_ext.bundle

什么给了?

如何加载libpq.5.dylib库?

【问题讨论】:

    标签: ruby-on-rails-3 postgresql libpq


    【解决方案1】:

    我在 Mac 上。这是我为使其正常工作所做的工作。

    cd /Library/Ruby/Gems/1.8/gems/pg-0.13.2/lib/
    otool -L pg_ext.bundle
    
    libpq.5.dylib (compatibility version 5.0.0, current version 5.4.0)
    

    请注意,libpq.5.dylib 不像 pg_ext.bundle 中的其他库那样使用绝对路径。系统找不到。您需要更改它查找 libpq.5.dylib 的位置。

    install_name_tool -change libpq.5.dylib /Library/PostgreSQL/9.1/lib/libpq.5.dylib pg_ext.bundle
    

    注意:使用适用于您系统的绝对路径。我使用了我的系统。

    现在运行:

    otool -L pg_ext.bundle
    

    注意 libpq.5.dylib 现在指向的内容:

    /Library/PostgreSQL/9.1/lib/libpq.5.dylib (compatibility version 5.0.0, current version 5.4.0)
    

    pg gem 现在应该很高兴了。

    【讨论】:

    【解决方案2】:

    here 的讨论看来,针对 32 位 Postgresql 编译 64 位 Ruby 的 pg 似乎是问题的根源。 所以解决它的唯一方法是安装64位Postgresql,然后重新安装pg

    This post 详细解释了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-05
      • 2012-12-07
      • 2012-02-29
      • 1970-01-01
      • 1970-01-01
      • 2014-01-09
      • 2014-01-17
      • 1970-01-01
      相关资源
      最近更新 更多