我似乎偶然遇到了类似的问题。在 Cent OS 6 上,我从 PostgreSQL YUM 存储库安装了二进制 PostgreSQL 9.3。从官方稳定版 tar 编译 GDAL 库版本 1.11.0。然后从原始 PostGIS 存储库编译 PostGIS 2.1.4dev。单元测试显示,它libgdal
没有被加载,因为它没有被发现。错误消息看起来类似于原始问题中的错误消息。@Craig 给出了使用strace
. 关键在于strace
专门附加到在客户端连接到 DBMS 之后创建的进程。附加strace
到 DBMS 后,让客户端请求服务器访问CREATE EXTENSION postgis
当前数据库并查看strace
. 就我而言,它给出了这个:
open("/lib64/tls/x86_64/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls/x86_64", 0x7fffefb20290) = -1 ENOENT (No such file or directory)
open("/lib64/tls/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
open("/lib64/x86_64/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64/x86_64", 0x7fffefb20290) = -1 ENOENT (No such file or directory)
open("/lib64/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib64", {st_mode=S_IFDIR|0555, st_size=12288, ...}) = 0
open("/usr/lib64/tls/x86_64/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls/x86_64", 0x7fffefb20290) = -1 ENOENT (No such file or directory)
open("/usr/lib64/tls/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/tls", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
open("/usr/lib64/x86_64/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64/x86_64", 0x7fffefb20290) = -1 ENOENT (No such file or directory)
open("/usr/lib64/libgdal.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/usr/lib64", {st_mode=S_IFDIR|0555, st_size=12288, ...}) = 0
它显示了 DBMS 尝试在哪些特定路径中查找库。在我的情况下,库位于/usr/local/lib/libgdal.so.1.18.0
符号链接中,以便在同一目录中使用更广泛的版本。我的解决方案是将这些文件的符号链接放入/usr/lib64
目录中。