为支持 LDAP 的 apache 编译 apr-util 时出错

为支持 LDAP 的 apache 编译 apr-util 时出错

我目前正在尝试在 CentOS 7 上创建一个自定义的 64 位 LAMPP 堆栈,其中每个组件都应位于其自己的文件夹中,并且每个依赖项都包含在其自己的文件夹中。

目前,我具有以下结构和正确编译的程序:

- /opt/lampp64
  - apr
  - bzip2
  - cyrus-sasl
  - gdbm
  - libtool
  - ncurses
  - openldap
  - openssl
  - pcre
  - perl
  - readline
  - zlib

每个软件都完整包含在其文件夹中,其中包含:

  • 每个版本对应一个目录
  • 指向“当前”版本的 simlink

我已经下载了最新版本的 apr-util 源并尝试编译它们,但是命令:

./configure --prefix=/opt/lampp64/apr-util/X.Y.Z --with-openssl=/opt/lampp64/openssl/current --with-openldap=/opt/lampp64/openldap/current

失败说无法找到 openldap,如果我禁用它,一切都会顺利。

我知道这不是标准的目录布局,这只是一个实验,但是其他具有依赖关系的程序已经被正确编译了。

我是否需要添加任何其他选项以configure使其“看到” LDAP 库?

这是整个命令和输出:

./configure --prefix=/opt/lampp64/apr-util/1.5.4 --with-apr=/opt/lampp64/apr/current --with-gdbm=/opt/lampp64/gdbm/current --with-openssl=/opt/lampp64/openssl/current --with-crypto --with-ldap=openldap --with-ldap-lib=/opt/lampp64/openldap/current/lib --with-ldap-include=/opt/lampp64/openldap/current/include
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.5.4
checking for chosen layout... apr-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Applying apr-util hints file rules for x86_64-unknown-linux-gnu
checking for APR... yes
  setting CPP to "gcc -E"
  adding "-pthread" to CFLAGS
  adding "-DLINUX" to CPPFLAGS
  adding "-D_REENTRANT" to CPPFLAGS
  adding "-D_GNU_SOURCE" to CPPFLAGS
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
configure: checking for openssl in /opt/lampp64/openssl/current
checking openssl/x509.h usability... yes
checking openssl/x509.h presence... yes
checking for openssl/x509.h... yes
checking for BN_init in -lcrypto... yes
checking for SSL_accept in -lssl... yes
  setting APRUTIL_LDFLAGS to "-L/opt/lampp64/openssl/current/lib"
  setting APRUTIL_INCLUDES to "-I/opt/lampp64/openssl/current/include"
checking whether EVP_PKEY_CTX_new is declared... yes
  setting LDADD_crypto_openssl to "-L/opt/lampp64/openssl/current/lib  -lssl -lcrypto"
checking for const input buffers in OpenSSL... yes
checking for ldap support...
  adding "-I/opt/lampp64/openldap/current/include" to APRUTIL_INCLUDES
  adding "-L/opt/lampp64/openldap/current/lib" to APRUTIL_LDFLAGS
checking for ldap_init in -lopenldap... no
checking for ldap_init in -lopenldap... no
checking for ldap_init in -lopenldap... no
checking for ldap_init in -lopenldap... no
configure: error: could not find an LDAP library

答案1

在该行中:

checking for ldap_init in -lopenldap... no

它试图链接到一个名为 openldap 的库,但是当我查看我的 openldap lib 目录时,我没有看到libopenldap.so

liblber.so
libldap.so
libldap_r.so

看起来值-lopenldap来自于--with-ldap=openldap选项,所以如果我将其更改为,--with-ldap=ldap它似乎可以工作。

不过,我还没有尝试过你提供的所有选项,所以我不知道其他方法是否都有效:)

答案2

我刚刚在 RHEL7 上遇到了类似的问题。我针对自定义编译的 openssl 编译 apr-util。结果发现 openssl-devel 包也已安装,但 apr-util 上的 ./configure 步骤总是失败。

所以对我来说诀窍是通过 yum 删除 openssl-devel 并重新编译整个堆栈(openssl、openldap、apr 和 apr-util)

相关内容