【问题标题】:PostGIS Error - PG::InternalError: ERROR: could not load libraryPostGIS 错误 - PG::InternalError: 错误: 无法加载库
【发布时间】:2016-02-03 04:12:51
【问题描述】:
StandardError: An error has occurred, this and all later migrations canceled:

PG::InternalError: ERROR:  could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
  Referenced from: /usr/local/lib/libSFCGAL.1.dylib
  Expected in: /usr/local/lib/libboost_serialization-mt.dylib
 in /usr/local/lib/libSFCGAL.1.dylib
: CREATE EXTENSION IF NOT EXISTS "postgis"/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
ActiveRecord::StatementInvalid: PG::InternalError: ERROR:  could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
  Referenced from: /usr/local/lib/libSFCGAL.1.dylib
  Expected in: /usr/local/lib/libboost_serialization-mt.dylib
 in /usr/local/lib/libSFCGAL.1.dylib
: CREATE EXTENSION IF NOT EXISTS "postgis"
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'
PG::InternalError: ERROR:  could not load library "/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so": dlopen(/usr/local/Cellar/postgresql/9.4.5/lib/postgis-2.1.so, 10): Symbol not found: __ZN5boost7archive21basic_binary_iarchiveINS0_15binary_iarchiveEE13load_overrideERNS0_15class_name_typeEi
  Referenced from: /usr/local/lib/libSFCGAL.1.dylib
  Expected in: /usr/local/lib/libboost_serialization-mt.dylib
 in /usr/local/lib/libSFCGAL.1.dylib
/Users/harshamv/Sites/clink/db/migrate/20150812164615_enable_postgis.rb:3:in `change'
-e:1:in `<main>'

当我尝试删除并重新创建我的 Rails-PostgreSQL 时,突然出现上述错误

【问题讨论】:

标签: ruby-on-rails macos postgresql ruby-on-rails-4 postgis


【解决方案1】:

您可能最近升级了boost Homebrew 公式,执行brew update / brew upgrade,看来最新版本与postgis 配合得不好。

我通过返回boost 的先前版本解决了一个非常相似的问题:

brew switch boost 1.58.0

更新:现在这已在 Homebrew 中得到修复,下面建议进行简单更新/升级的答案可能是可行的方法。如果您之前确实切换过,现在可以brew switch boost 1.59.0 升级到最新版本的boost,您可能还需要brew reinstall postgis。

【讨论】:

  • 太棒了!那是我的问题! @Harsha 你应该接受这个答案!
  • 是的..当我做 brew update 时更新了 boost :/ 这是保持正常但继续获取最新的最好方法?
  • 我的 1.58.0 版本不见了,所以我得到了Error: boost does not have a version "1.58.0" in the Cellar. Versions available: 1.59.0。如何获取旧版本?
  • 从 /usr/local/Cellar/boost/ 的 Time Machine 备份中恢复它。您的解决方案有效 - 谢谢!有人在 PostGIS / boost 上提出过问题吗?
  • 有人提供 boost 1.58 吗?我在使用全新的计算机,但无法获取它
【解决方案2】:

这个issue has been fixed here。重新安装,它应该可以工作。

    $ brew update && upgrade
    $ brew install postgis

【讨论】:

    【解决方案3】:

    也找不到 1.58.0,但 1.55.0_1 可用并为我成功安装了 postgis。 effectif 和 stackoverflow 中的这些条目非常有帮助。该过程可能有额外的步骤。

    只是为了确定:

    $ brew uninstall postgis
    

    如果还没有自制版本,请点击:

    $ brew tap homebrew/versions
    

    找到最新的可用:

    $ brew search boost
    ...
    homebrew/versions/boost155
    ...
    $ brew install homebrew/versions/boost155
    

    这会在不同的公式 (boost155) 下安装 boost。为了能够切换版本,我将旧版本符号链接到 boost 目录:

    $ ln -s /usr/local/Cellar/boost155/1.55.0_1 /usr/local/Cellar/boost/1.55.0_1 
    

    之后一切照旧:

    $ brew switch boost 1.55.0_1
    $ brew install postgis
    

    【讨论】:

      【解决方案4】:

      如果您需要安装特定版本的公式,请查看此线程:

      Homebrew: install specific version of formula

      【讨论】:

        【解决方案5】:

        我也遇到了这个问题,boost 的 1.56.0 版本可用并为我解决了这个问题。看起来问题出在 1.58.0 上。

        【讨论】:

          猜你喜欢
          • 2015-06-23
          • 2023-03-15
          • 1970-01-01
          • 2016-02-23
          • 1970-01-01
          • 2014-12-24
          • 1970-01-01
          • 1970-01-01
          • 2014-09-28
          相关资源
          最近更新 更多