4

我只是想将 Python 绑定到安装在 Red Hat Enterprise 机器上的 Mapnik 2.1 并在 Sage (sagemath.org) 中使用它们。这是我不能使用 yum 的公司机器,所以它一直是 tarball,宝贝。

我已经解决了安装依赖项和制定每个配置所需的语法的许多问题。每次我解决一个问题,就会有另一个问题。目前我无法让 mapnik 配置来查看 libboost_system.so,它肯定在 /usr/local/lib 中,并且有一个从 /usr/lib 指向它的符号链接。

细节:

Red Hat Enterprise system:
> more /proc/version
Linux version 2.6.18-92.el5PAE (brewbuilder@hs20-bc2-3.build.redhat.com) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-41)) 
used install directions at github.com/mapnik/mapnik/blob/master/INSTALL.md, github.com/mapnik/mapnik/wiki/Mapnik2 and elsewhere
installed proj 4.8 from tarball using several solutions provided on the web to fix install problems
installed icu4c-4_6 from tarball to /usr/local/...
installed boost 1.51 from tarball pointing to the newly installed icu:
download boost_1_51_0.tar.gz
tar ...
cd boost_1_51_0
./bootstrap.sh

(之前我已经直接 ./b2 来安装所有的 boost - 使用上面的网页说明返回以这种方式重新安装 boost 的一部分:)

sudo ./b2 --with-thread --with-filesystem --with-iostreams --with-python --with-regex -sHAVE_ICU=1 -sICU_PATH=/usr/local/lib --with-program_options --with-system link=shared toolset=gcc stage
sudo ./b2 --with-thread --with-filesystem --with-iostreams --with-python --with-regex -sHAVE_ICU=1 -sICU_PATH=/usr/local/lib --with-program_options --with-system link=shared toolset=gcc install
sudo /sbin/ldconfig

现在尝试安装mapnik:

download mapnik-v2.1.0.tar.bz2
tar ...
cd ...
./configure PYTHON=/opt/sage-5.2/local/bin/python ICU_LIBS=/usr/local/lib ICU_INCLUDES=/usr/local/include BOOST_INCLUDES=/usr/local/include/boost BOOST_LIBS=/usr/local/lib

或者

./configure PYTHON=/opt/sage-5.2/local/bin/python ICU_LIBS=/usr/local/lib ICU_INCLUDES=/usr/local/include

或者

./configure PYTHON=/opt/sage-5.2/local/bin/python

(结果相同)

"scons: Reading SConscript files ...
Welcome to Mapnik...
Configuring build environment...
SCons CONFIG found: 'config.py', variables will be inherited...
Configuring on Linux in *release mode*...
Checking for freetype-config... yes
Checking for xml2-config... yes
Sorting lib and inc compiler paths...(cached) yes
Checking for C library m... yes
Checking for C library ltdl... yes
Checking for C library png... yes
Checking for C library tiff... yes
Checking for C library z... yes
Checking for C library proj... yes
Checking for C++ library icuuc... yes
Checking for C library jpeg... yes
Checking for ICU version >= 4.2... found: icu 4.6
(cached) Searching for boost libs and headers... (cached)
  *libs found: /usr/local/lib
  *headers found: /usr/local/include
  *no lib naming extension found
Checking for Boost version >= 1.47... yes
Found boost lib version... 1_51
Checking for C++ library boost_system... yes
Checking for C++ library boost_filesystem... yes
Checking for C++ library boost_regex... yes
Checking for C++ library boost_program_options... yes
Checking for C++ library boost_thread... yes
.sconf_temp/conftest_18: error while loading shared libraries: libboost_system.so.1.51.0: 
cannot open shared object file: No such file or directory
Checking if boost_regex was built with ICU unicode support... (cached) no
Checking for requested plugins dependencies...
Checking for gdal-config --libs... yes
Checking for gdal-config --cflags... yes
Checking for name of gdal library... gdal
Checking if gdal is ogr enabled... yes
Checking for name of ogr library... gdal
Checking for C library curl... no
Checking for pg_config... error: no result no
Checking for C library sqlite3... no
Checking if SQLite supports RTREE... (cached) no
Checking for pkg-config... yes
Checking for cairo... no
Checking for C++ header file boost/python/detail/config.hpp... yes
Checking for pkg-config... yes
Checking for pycairo... no
All Required dependencies found!
Overwriting and re-saving file 'config.py'...
Will hold custom path variables from commandline and python config file(s)...

注意:将在没有这些可选依赖项的情况下构建:

  • boost_regex_icu(mapnik 中的 unicode regex 支持需要使用可选 ICU unicode 支持构建的 libboost_regex。)

  • curl(“osm”插件需要 libcurl - 更多信息:https ://github.com/mapnik/mapnik/wiki//OsmPlugin )

  • pg_config (pg_config 程序 | 尝试设置 PG_CONFIG SCons 选项)

  • sqlite3(SQLite3 C 库 | 使用 SQLITE_LIBS 和 SQLITE_INCLUDES 进行配置 | 更多信息:https ://github.com/mapnik/mapnik/wiki//SQLite )

  • sqlite_rtree(SQLite 插件需要使用 RTREE 支持构建的 libsqlite3 (-DSQLITE_ENABLE_RTREE=1))

  • cairo(Cairo C 库 | 使用 pkg-config 配置 | 尝试设置 PKG_CONFIG_PATH SCons 选项)

  • pycairo(Python 绑定到 Cairo 库 | 使用 pkg-config 配置 | 尝试设置 PKG_CONFIG_PATH SCons 选项)

    .sconf_temp/conftest_33:加载共享库时出错:libboost_system.so.1.51.0:无法打开共享对象文件:没有这样的文件或目录解析mapnik版本时遇到问题,回退到2.1.0检查C头文件Python.h ... 是绑定 Python 版本... 2.7 Python 2.7 前缀... /opt/sage-5.2/local Python 绑定将安装在... /opt/sage-5.2/local/lib/python2.7/site-包配置完成:运行make以构建或make install“make”... /usr/bin/ld:找不到 -lsqlite3 collect2:错误:ld 返回 1 退出状态 scons:* [tests/cpp_tests/csv_parse_test-bin] 错误 1 ​​scons:建筑物因错误而终止。制作:* [mapnik] 错误 2"

但我认为 sqlite3 是可选的......

我认为 sqlite3 问题可能是一个红鲱鱼。前面的问题是configure阶段没有找到boost_thread。我的系统显示:

ls -l /usr/local/lib/libboost_system.so*
lrwxrwxrwx 1 root root    25 Sep 11 17:40 /usr/local/lib/libboost_system.so -> libboost_system.so.1.51.0
-rwxr-xr-x 1 root root 16898 Sep 11 17:40 /usr/local/lib/libboost_system.so.1.51.0
ldd /usr/local/lib/libboost_system.so.1.51.0
        linux-gate.so.1 =>  (0x005c1000)
        librt.so.1 => /lib/librt.so.1 (0x00cd9000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x002f4000)
        libm.so.6 => /lib/libm.so.6 (0x009e1000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00f82000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00a6a000)
        libc.so.6 => /lib/libc.so.6 (0x00110000)
        /lib/ld-linux.so.2 (0x0050d000)

所以它确实存在并且有效。

为了安全起见(这没有帮助)添加了一个符号链接:

ls -l /usr/lib/libboost_system.so
lrwxrwxrwx 1 root root 33 Sep 14 10:16 /usr/lib/libboost_system.so -> /usr/local/lib/libboost_system.so

这很奇怪,因为在同一位置可以找到其他库。此外,配置阶段在“搜索提升库和标头...找到的库:/usr/local/lib”错误之前说明了几行

在这一点上,我真的不相信scons。我遇到了另一个问题,mapnik 配置阶段找不到库 (libproj)。后来又说boost的版本至少不是1.48。一旦我添加了指向 proj .so 文件的正确符号链接,关于 boost 版本的配置错误就消失了。所以我坚持一般规则,你应该专注于发现的第一个错误并解决那个错误。

请注意,Python 的非标准位置(PYTHON=/opt/sage-5.2/local/bin/python)似乎没问题。

查看 mapnik 日志文件 config.log,但我看不到其他信息。检查了网络和 github.com/mapnik/mapnik/wiki/InstallationTroubleshooting 但没有任何相关。很抱歉这篇文章很长,但细节很重要。谢谢阅读。

另一个线索可能是:

Checking if boost_regex was built with ICU unicode support... (cached) no

即使上面表明这是正确完成的(?)。

4

3 回答 3

3

明火,

Mapnik 用户列表将是一个更好的地方。

无论如何,我认为问题在于您尚未配置系统以在 /usr/local/lib 中查找库。你需要做export LD_LIBRARY_PATH=/usr/local/lib或者你需要在运行之前添加/usr/local/lib到你的./etc/ld.so.conf/ldconfig

可能会混淆的小问题:1)您的 BOOST_INCLUDES 选项是错误的,应该BOOST_INCLUDES=/usr/local/include/不是BOOST_INCLUDES=/usr/local/include/boost。2)我真的不建议符号链接到/usr/lib- 这可能会破坏事情是奇怪的方式

此外,尽管在配置过程中出现链接错误,但我认为您总体上还可以。与测试的链接错误没什么大不了的,很可能我们需要将其设为可选。我认为构建过程中唯一的主要问题是提升链接,这应该可以按照上面的方法解决。

于 2012-09-14T19:02:06.210 回答
0

我和你有同样的问题,我在这里看到了

export LD_LIBRARY_PATH=/XXX/lib 

会工作。

我试过了,它对我有用,但我仍然不确定根本原因是什么。

于 2013-10-09T00:02:22.710 回答
0

在 Centos 7 上构建 Mapnik 遇到了同样的问题。Scon 给出了关于缺少实际存在的库的误导性错误。

发出简单的

export LD_LIBRARY_PATH=/usr/local/lib

修复了所有问题。

应该是对 Centos / RHEL 上许多构建的修复,不仅仅是 Mapnik。

于 2016-09-20T15:46:02.420 回答