在MacOS 10.12上使用PostGIS 2.4.4构建问题

时间:2018-04-20 20:25:43

标签: postgis macports

我正在尝试在MacOS 10.12上使用MacPorts构建PostGIS 2.4.4,用于各种库。构建当前失败(连接shp2pgsql时):

Undefined symbols for architecture x86_64:
 "_iconv", referenced from:
     _utf8 in shp2pgsql-core.o
 "_iconv_close", referenced from:
     _utf8 in shp2pgsql-core.o
 "_iconv_open", referenced from:
     _utf8 in shp2pgsql-core.o
ld: symbol(s) not found for architecture x86_64

一些研究表明,MacPorts安装的libiconv存在问题,应该使用系统库,但我没有成功使用--with-libiconv-prefix和--with-libiconv指向/ usr中的系统库。有人这么成功吗?

3 个答案:

答案 0 :(得分:1)

我对尝试配置选项不够勤奋;将其设置为显式使用已安装的Macconorts libconv:

./configure --with-libiconv-prefix=/opt/local --with-libiconv=/opt/local

答案 1 :(得分:0)

您是否意识到MacPorts提供了该版postgis的端口?

$ port info postgis2
postgis2 @2.4.4 (databases, gis)
Variants:             comments, gui, [+]postgresql10, postgresql93, postgresql94, postgresql95, postgresql96, proj4, [+]raster, sfcgal, [+]topology, universal

Description:          PostGIS 2 adds geometrical, geographical and topological types, and functions operating thereon, to the PostGreSQL database.     The 2.0 release also provides raster handling and basic 3D geometry capacities
                      (TIN and polyhedra).
Homepage:             http://postgis.refractions.net/

Build Dependencies:   autoconf, automake, libtool, libxslt
Library Dependencies: geos, proj, libiconv, libxml2, json-c, postgresql10, gdal
Conflicts with:       postgis
Platforms:            darwin
License:              GPL-2+
Maintainers:          Email: vince@macports.org
                      Policy: openmaintainer

答案 2 :(得分:0)

当您不匹配标头和库时会发生此问题。例如。使用/usr/include中的iconv标头进行编译,但链接/opt/local/lib中的iconv库会导致此问题。

这是因为MacPorts安装的iconv标头包含#define iconv libiconv,这是图书馆提供的符号。这不是MacPorts决定发布这个定义,顺便说一下;它是上游的默认值。