PostGIS错误 - PG :: InternalError:错误:无法加载库

15
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时,突然出现了上述错误。


请看http://cookieshq.co.uk/posts/introduction-to-postgis-and-rails/。 - SSR
PostGIS没有正确安装。您能否更新您的问题,包括您是如何安装它的? - Swanand
@Swanand,正如答案中所提到的那样,这是boost的问题。 - Harsha M V
5个回答

13
您可能最近通过 brew update / brew upgrade 升级了 boost Homebrew 公式,最新版本似乎与 postgis 不兼容。

我通过以下方式解决了非常类似的问题:

brew switch boost 1.58.0

更新:现在 Homebrew 已经修复了这个问题,下面的答案建议简单更新/升级。如果您之前进行了切换,现在可以使用 brew switch boost 1.59.0 来升级到最新版本的 boost,您可能还需要 brew reinstall postgis


太棒了!这就是我的问题所在!@Harsha,你应该接受这个答案! - ZedTuX
1
是的,当我执行brew update时,boost也会更新:/ 有什么最好的方法可以保持正常但继续获取最新的内容吗? - Harsha M V
1
我的1.58.0版本不见了,所以我收到了“错误:在酒窖中没有版本为‘1.58.0’的boost。可用版本:1.59.0”。我该如何获取旧版本? - n1000
1
从 Time Machine 备份中恢复到 /usr/local/Cellar/boost/ 目录下。你的解决方案有效 - 谢谢!有人在 PostGIS / boost 上提出了问题吗? - n1000
有人有boost 1.58可用吗?我在一台全新的电脑上,无法获取它。 - Tyler DeWitt
显示剩余3条评论

5

3

我找不到1.58.0版本,但是1.55.0_1版本可用并成功为我安装了postgis。这些effectifstackoverflow中的条目非常有帮助。该过程可能需要额外的步骤。

只是为了确保:

$ brew uninstall postgis

如果您还没有Homebrew,请点击安装:

$ 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

2

我也遇到了这个问题,但是使用版本为1.56.0的boost可以解决这个问题。看起来问题具体出在1.58.0版本。


2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接