Apache 使用httpd 2.4和APR&x2B编译/链接问题;Ldap-“;未定义的引用…“;

Apache 使用httpd 2.4和APR&x2B编译/链接问题;Ldap-“;未定义的引用…“;,apache,linker-errors,Apache,Linker Errors,我在ApacheHTTPD2.4和APR+Ldap支持的链接问题上陷入了困境。我在链接步骤中不断出现“未定义引用”错误。以下是我所做的: 手动编译并安装APR,无错误 cd ~/httpd24/httpd-2.4.20/srclib/apr ./configure --prefix=/appserver/apache_httpd >configure.log 2>&1 make make install cd ~/httpd24/httpd-2.4.20/srclib/ap

我在ApacheHTTPD2.4和APR+Ldap支持的链接问题上陷入了困境。我在链接步骤中不断出现“未定义引用”错误。以下是我所做的:

手动编译并安装APR,无错误

cd ~/httpd24/httpd-2.4.20/srclib/apr
./configure --prefix=/appserver/apache_httpd >configure.log 2>&1
make
make install
cd ~/httpd24/httpd-2.4.20/srclib/apr-util
./configure --prefix=/appserver/apache_httpd --with-ldap --with-apr=../apr --with-crypto >configure.log 2>&1
make
make install
手动编译并安装APR Util,无错误

cd ~/httpd24/httpd-2.4.20/srclib/apr
./configure --prefix=/appserver/apache_httpd >configure.log 2>&1
make
make install
cd ~/httpd24/httpd-2.4.20/srclib/apr-util
./configure --prefix=/appserver/apache_httpd --with-ldap --with-apr=../apr --with-crypto >configure.log 2>&1
make
make install
这就是问题发生的地方

cd ~/httpd24/httpd-2.4.20
./configure --prefix=/appserver/apache_httpd --with-ldap --with-included-apr --enable-mods-shared=most --disable-http2 --with-crypto --enable-authnz-ldap --enable-ldap >configure.log 2>&1
make

[...]

gcc -std=gnu99 -g -O2 -pthread -DLINUX -D_REENTRANT -D_GNU_SOURCE -I. -I/home/asadmin/httpd24/httpd-2.4.20/os/unix -I/home/asadmin/httpd24/httpd-2.4.20/include -I/home/asadmin/httpd24/httpd-2.4.20/srclib/apr/include -I/home/asadmin/httpd24/httpd-2.4.20/srclib/apr-util/include -I/home/asadmin/httpd24/httpd-2.4.20/modules/aaa -I/home/asadmin/httpd24/httpd-2.4.20/modules/cache -I/home/asadmin/httpd24/httpd-2.4.20/modules/core -I/home/asadmin/httpd24/httpd-2.4.20/modules/database -I/home/asadmin/httpd24/httpd-2.4.20/modules/filters -I/home/asadmin/httpd24/httpd-2.4.20/modules/ldap -I/home/asadmin/httpd24/httpd-2.4.20/modules/loggers -I/home/asadmin/httpd24/httpd-2.4.20/modules/lua -I/home/asadmin/httpd24/httpd-2.4.20/modules/proxy -I/home/asadmin/httpd24/httpd-2.4.20/modules/session -I/home/asadmin/httpd24/httpd-2.4.20/modules/ssl -I/home/asadmin/httpd24/httpd-2.4.20/modules/test -I/home/asadmin/httpd24/httpd-2.4.20/server -I/home/asadmin/httpd24/httpd-2.4.20/modules/arch/unix -I/home/asadmin/httpd24/httpd-2.4.20/modules/dav/main -I/home/asadmin/httpd24/httpd-2.4.20/modules/generators -I/home/asadmin/httpd24/httpd-2.4.20/modules/mappers -c /home/asadmin/httpd24/httpd-2.4.20/server/buildmark.c
/home/asadmin/httpd24/httpd-2.4.20/srclib/apr/libtool --silent --mode=link gcc -std=gnu99 -g -O2 -pthread -o httpd modules.lo buildmark.o -export-dynamic server/libmain.la modules/core/libmod_so.la modules/http/libmod_http.la server/mpm/event/libevent.la os/unix/libos.la -lpcre /home/asadmin/httpd24/httpd-2.4.20/srclib/apr-util/libaprutil-1.la -lexpat /home/asadmin/httpd24/httpd-2.4.2a0/srclib/apr/libapr-1.la -lrt -lcrypt -lpthread
server/.libs/libmain.a(exports.o):(.data+0x27a8): undefined reference to `apr_ldap_ssl_init'
server/.libs/libmain.a(exports.o):(.data+0x27b0): undefined reference to `apr_ldap_ssl_deinit'
server/.libs/libmain.a(exports.o):(.data+0x27b8): undefined reference to `apr_ldap_init'
server/.libs/libmain.a(exports.o):(.data+0x27c0): undefined reference to `apr_ldap_info'
server/.libs/libmain.a(exports.o):(.data+0x27c8): undefined reference to `apr_ldap_get_option'
server/.libs/libmain.a(exports.o):(.data+0x27d0): undefined reference to `apr_ldap_set_option'
server/.libs/libmain.a(exports.o):(.data+0x27d8): undefined reference to `apr_ldap_rebind_init'
server/.libs/libmain.a(exports.o):(.data+0x27e0): undefined reference to `apr_ldap_rebind_add'
server/.libs/libmain.a(exports.o):(.data+0x27e8): undefined reference to `apr_ldap_rebind_remove'
server/.libs/libmain.a(exports.o):(.data+0x27f0): undefined reference to `apr_ldap_is_ldap_url'
server/.libs/libmain.a(exports.o):(.data+0x27f8): undefined reference to `apr_ldap_is_ldaps_url'
server/.libs/libmain.a(exports.o):(.data+0x2800): undefined reference to `apr_ldap_is_ldapi_url'
server/.libs/libmain.a(exports.o):(.data+0x2808): undefined reference to `apr_ldap_url_parse_ext'
server/.libs/libmain.a(exports.o):(.data+0x2810): undefined reference to `apr_ldap_url_parse'
collect2: ld returned 1 exit status
make[1]: *** [httpd] Error 1
make[1]: Leaving directory `/home/asadmin/httpd24/httpd-2.4.20'
make: *** [all-recursive] Error 1 
在网上做了一些研究后,我了解了“nm”工具和--demangle选项,该选项通常用于解决链接相关问题。我承认我没有足够的经验充分利用这个工具和它的发现,但以下是我发现的:

asadmin@packaging:~/httpd24/httpd-2.4.20> for f in `find . -type f -name "*.o"`; do obj_file="$f"; nm --demangle $f | grep apr_ldap_ && echo "^ $obj_file"; done
0000000000000000 t apr_ldap_pool_cleanup_set_null
00000000000000b0 t apr_ldap_rebind_remove_helper
0000000000000000 b apr_ldap_xref_lock
^ ./srclib/apr-util-1.5.4/ldap/.libs/apr_ldap_rebind.o
0000000000000000 t apr_ldap_pool_cleanup_set_null
00000000000000b0 t apr_ldap_rebind_remove_helper
0000000000000000 b apr_ldap_xref_lock
^ ./srclib/apr-util-1.5.4/ldap/apr_ldap_rebind.o
00000000000027c8 D ap_hack_apr_ldap_get_option
00000000000027c0 D ap_hack_apr_ldap_info
00000000000027b8 D ap_hack_apr_ldap_init
00000000000027f0 D ap_hack_apr_ldap_is_ldap_url
0000000000002800 D ap_hack_apr_ldap_is_ldapi_url
00000000000027f8 D ap_hack_apr_ldap_is_ldaps_url
00000000000027e0 D ap_hack_apr_ldap_rebind_add
00000000000027d8 D ap_hack_apr_ldap_rebind_init
00000000000027e8 D ap_hack_apr_ldap_rebind_remove
00000000000027d0 D ap_hack_apr_ldap_set_option
00000000000027b0 D ap_hack_apr_ldap_ssl_deinit
00000000000027a8 D ap_hack_apr_ldap_ssl_init
0000000000002810 D ap_hack_apr_ldap_url_parse
0000000000002808 D ap_hack_apr_ldap_url_parse_ext
                 U apr_ldap_get_option
                 U apr_ldap_info
                 U apr_ldap_init
                 U apr_ldap_is_ldap_url
                 U apr_ldap_is_ldapi_url
                 U apr_ldap_is_ldaps_url
                 U apr_ldap_rebind_add
                 U apr_ldap_rebind_init
                 U apr_ldap_rebind_remove
                 U apr_ldap_set_option
                 U apr_ldap_ssl_deinit
                 U apr_ldap_ssl_init
                 U apr_ldap_url_parse
                 U apr_ldap_url_parse_ext
^ ./server/exports.o
asadmin@packaging:~/httpd24/httpd-2.4.20> 
因此,这些apr_ldap_*引用被列为未定义的U,因此出现错误。但是,有一些ap\U hack\U apr\U ldap\u*引用正在链接。。。这些是某种包装纸吗?我想知道是否有人试图使用这些apr\u ldap\u*引用,但它们没有定义,应该使用链接的ap\u hack\u apr\u*版本。我真的不知道哪里出了问题,但那只是我的猜测。有什么想法吗

此外,我还安装了openldap和openldap开发包:

asadmin@packaging:~/httpd24/httpd-2.4.20> rpm -qa | grep openldap
openldap-2.4.40-12.el6.x86_64
openldap-devel-2.4.40-12.el6.x86_64

我也有同样的问题。在我的例子中,我认为这是因为apr util上的错误编译。我是用以下方法编写的:

./configure--with apr=/usr/local/apr/bin--with ldap;制作制作安装

并且在尝试编译httpd时收到了上面描述的错误。我回到apr util并发布了一个“make distclean”,然后重新运行上面的步骤。然后,httpd就可以编译了。我认为我在apr-util上的分发副本与以前的编译不一致。

/p>/configure--with apr=/usr/src/apr-1.6.3--with apr-util=/usr/src/apr-util-1.6.1--enable-md enable-http2--enable-proxy-http2--enable-ssl