当我编译 Cyrus 的 seiveshell 时,如何链接到 PostgreSQL 库?

发布于 2024-08-02 08:33:23 字数 2564 浏览 2 评论 0原文

我维护一个由 Perl 和 Cyrus IMAP 等组成的软件堆栈。

Perl 似乎运行良好,Cyrus cyradm(一个 Perl 脚本)也运行良好。然而,sieveshell 不会执行并原因在此寻求帮助。

当我运行 sieveshell 时,我得到以下输出:

无法加载“/usr/local/pozix/perl-5.10.0/lib/site_perl/5.10.0/i686-linux-thread-multi/auto/Cyrus/SIEVE/managesieve/managesieve.so”模块 Cyrus::SIEVE::managesieve: /usr/local/pozix/perl-5.10.0/lib/site_perl/5.10.0/i686-linux-thread-multi/auto/Cyrus/SIEVE/managesieve/managesieve.so:未定义符号:PQfinish 位于 /usr/local/pozix/perl-5.10.0/lib/5.10.0/i686-linux-thread-multi/DynaLoader.pm 第 203 行。 在 ./sieveshell 第 45 行 在 ./sieveshell 第 45 行的 require 中编译失败。 BEGIN 失败——编译在 ./sieveshell 第 45 行中止。

PQfinish 是 PostgreSQL 库的一部分。如果我在managesieve.so上运行ldd,PGSQL库不会被链接,但是也没有丢失的库。如果我在列出的 libsasl2 库上运行 ldd,它看起来也不错,并且确实使用 PGSQL,但它显然不是链接到 Managesieve.so 的库的一部分。此外,libsasl2在被其他软件使用时工作正常。

这里是 ldd managesieve.so

linux-gate.so.1 =>  (0xffffe000)
libdb-4.4.so => /lib/libdb-4.4.so (0xb7f8a000)
libsasl2.so.2 => /usr/local/pozix/cyrus-sasl/lib/libsasl2.so.2 (0xb7f74000)
libssl.so.0 => /usr/lib/libssl.so.0 (0xb7f33000)
libcrypto.so.0 => /usr/lib/libcrypto.so.0 (0xb7df6000)
libc.so.6 => /lib/libc.so.6 (0xb7caa000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7c92000)
libdl.so.2 => /lib/libdl.so.2 (0xb7c8e000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb7c7b000)
/lib/ld-linux.so.2 (0xb80aa000)

ldd usr/local/pozix/cyrus-sasl/lib/libsasl2.so.2

linux-gate.so.1 =>  (0xffffe000)
libdl.so.2 => /lib/libdl.so.2 (0xb7f0a000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb7ef7000)
libc.so.6 => /lib/libc.so.6 (0xb7dab000)
/lib/ld-linux.so.2 (0xb7f34000)

在 Cyrus IMAP 的构建过程中也没有编译错误。我怀疑这可能是路径问题,但不确定在哪里查看或调试路径输出或下一步该去哪里。

尝试用谷歌搜索这个问题并得到了一些结果,但他们要么没有解决方案,要么对我不起作用。我怀疑 Perl AUTOLOAD 在某种程度上被混淆了。 DBD::Pg 似乎也能正常工作;使用版本 2.15.1。

关于下一步该去哪里有什么建议吗?有 Perl 专家吗?

解决了!

./configure 在每个子目录中构建 Makefile。 Managesieve.so 库是通过 Perl 的调用创建的...IE Perl Makefile.PL 生成一个 Makefile。安德鲁的建议对追踪此事有很大帮助。在 Makefile 中有以下几行:

EXTRALIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -lsasl2 -lssl -lcrypto 
LDLOADLIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -lsasl2 -lssl -lcrypto 

我更新为:

EXTRALIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -L/usr/local/pozix/pgsql/lib -lsasl2 -lssl -lcrypto -lpq

LDLOADLIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -L/usr/local/pozix/pgsql/lib -lsasl2 -lssl -lcrypto -lpq

这解决了它!

I maintain a software stack consisting of Perl and Cyrus IMAP among other things.

Perl seems to be working fine and Cyrus cyradm (a perl script) works fine too. However, sieveshell will not execute and reason for asking for help here.

When I run sieveshell, I get the follow output:

Can't load '/usr/local/pozix/perl-5.10.0/lib/site_perl/5.10.0/i686-linux-thread-multi/auto/Cyrus/SIEVE/managesieve/managesieve.so' for module Cyrus::SIEVE::managesieve: /usr/local/pozix/perl-5.10.0/lib/site_perl/5.10.0/i686-linux-thread-multi/auto/Cyrus/SIEVE/managesieve/managesieve.so: undefined symbol: PQfinish at /usr/local/pozix/perl-5.10.0/lib/5.10.0/i686-linux-thread-multi/DynaLoader.pm line 203.
at ./sieveshell line 45
Compilation failed in require at ./sieveshell line 45.
BEGIN failed--compilation aborted at ./sieveshell line 45.

PQfinish is part of the PostgreSQL libraries. If I run ldd on managesieve.so, the PGSQL libs are not linked in however, there are no missing libraries either. If I run ldd on libsasl2 library listed, it looks OK too and it does use PGSQL but it is apparently not part of the library linked to managesieve.so. Moreover, libsasl2 is working fine when used by other software.

Here is ldd managesieve.so

linux-gate.so.1 =>  (0xffffe000)
libdb-4.4.so => /lib/libdb-4.4.so (0xb7f8a000)
libsasl2.so.2 => /usr/local/pozix/cyrus-sasl/lib/libsasl2.so.2 (0xb7f74000)
libssl.so.0 => /usr/lib/libssl.so.0 (0xb7f33000)
libcrypto.so.0 => /usr/lib/libcrypto.so.0 (0xb7df6000)
libc.so.6 => /lib/libc.so.6 (0xb7caa000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7c92000)
libdl.so.2 => /lib/libdl.so.2 (0xb7c8e000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb7c7b000)
/lib/ld-linux.so.2 (0xb80aa000)

ldd usr/local/pozix/cyrus-sasl/lib/libsasl2.so.2

linux-gate.so.1 =>  (0xffffe000)
libdl.so.2 => /lib/libdl.so.2 (0xb7f0a000)
libresolv.so.2 => /lib/libresolv.so.2 (0xb7ef7000)
libc.so.6 => /lib/libc.so.6 (0xb7dab000)
/lib/ld-linux.so.2 (0xb7f34000)

There are no compilation errors during the building of Cyrus IMAP either. I suspect this could be a path problem but not sure where to look or debug the path output or where to go next on this.

Tried googling for this and got a couple hits but they either had no solution or didn't work for me. I suspect the Perl AUTOLOAD is confused in some way. DBD::Pg appears to be working as well; using version 2.15.1.

Any suggestions on where to go next? Any Perl gurus out there?

SOLVED!

./configure builds the Makefiles in each sub-directory. The managesieve.so library is created with a call from Perl... I.E. Perl Makefile.PL resulting in a Makefile. Andrew's advise helped immensely in tracking this down. In the Makefile there are the following lines:

EXTRALIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -lsasl2 -lssl -lcrypto 
LDLOADLIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -lsasl2 -lssl -lcrypto 

Which I updated to read:

EXTRALIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -L/usr/local/pozix/pgsql/lib -lsasl2 -lssl -lcrypto -lpq

LDLOADLIBS = -ldb-4.4 -L/usr/local/pozix/cyrus-sasl/lib -L/usr/local/pozix/pgsql/lib -lsasl2 -lssl -lcrypto -lpq

And this solved it!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

欢烬 2024-08-09 08:33:23

听起来您需要重新编译 sieve 共享库并包含 -lPGSql (或其他内容)。是否有需要添加“--with-postgres”的配置脚本?如果没有,您可能必须手动编辑 Makefile(或 Makefile.PL 或 Build.PL)。

Sounds like you need to re-compile the sieve shared library and include the -lPGSql (or whatever). Is there a configure script that you need to add a '--with-postgres' to? If not, you may have to manually edit the Makefile (or Makefile.PL, or Build.PL).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文