apache - 加载 Apache2 mod_xml2enc 时 undefined symbol

标签 apache centos5 undefined-symbol mod-proxy-html

我对在 CentOS 5 机器上向 Apache2 HTTP 服务器安装反向代理相关模块感到非常沮丧。由于它是旧版本的 Apache2 服务器,我不得不使用 Apache 工具“apxs”从源代码编译模块。我没有收到通过“apxs”安装模块的警告或错误,但在尝试重新启动 Apache 服务器时出现运行时错误。

Starting httpd: httpd: Syntax error on line 206 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib64/httpd/modules/mod_xml2enc.so into server: /usr/lib64/httpd/modules/mod_xml2enc.so: undefined symbol: xmlDetectCharEncoding
                                                           [FAILED]

下面是更多的细节。

OS:  CentOS 5.11; Linux 2.6.18-400.1.1.el5 #1 SMP Thu Dec 18 00:59:53 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
Apache: version 2.2.3

由于历史原因,我无法将它们中的任何一个升级到较新的版本来解决问题。

操作系统本来就缺少libxml2,我用yum安装成功没有问题。我下载了 mod_proxy_html 的源文件,包括 1) mod_xml2enc.c、2) mod_proxy_html.h 和 3) mod_proxy_html.c

我使用以下命令首先安装 mod_xml2enc,然后安装 mod_proxy_html。

apxs -i -a -c -I /usr/include/libxml2/ mod_xml2enc.c
apxs -i -a -c -I /usr/include/libxml2/ -I ./ mod_proxy_html.c

两者看起来都不错,并显示了如下所示的一些输出:

/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/include/libxml2/  -c -o mod_xml2enc.lo mod_xml2enc.c && touch mod_xml2enc.slo
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_xml2enc.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_xml2enc.lo
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_xml2enc.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp mod_xml2enc.la /usr/lib64/httpd/modules/
cp .libs/mod_xml2enc.so /usr/lib64/httpd/modules/mod_xml2enc.so
cp .libs/mod_xml2enc.lai /usr/lib64/httpd/modules/mod_xml2enc.la
cp .libs/mod_xml2enc.a /usr/lib64/httpd/modules/mod_xml2enc.a
chmod 644 /usr/lib64/httpd/modules/mod_xml2enc.a
ranlib /usr/lib64/httpd/modules/mod_xml2enc.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib64/httpd/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib64/httpd/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib64/httpd/modules/mod_xml2enc.so
[activating module `xml2enc' in /etc/httpd/conf/httpd.conf]

但是,当我尝试重新启动服务器时,出现了我放在顶部的错误消息。

我尝试了很多方法来解决这个问题,但是,没有任何效果。也许值得注意的是,我采取了在 CentOS 5.11 32 位机器上安装相同模块的确切步骤并且完全没有问题。这两台机器之间的唯一区别是一台是 32 位的,另一台是 64 位的。

希望有人知道如何解决这个问题。

非常感谢。

最佳答案

我自己找到了解决这个问题的方法。这是一个愚蠢的。我忘了将 libxml2 加载到 Apache 服务器。添加 LoadFile/usr/lib64/libxml2.so 后,错误消失了。

关于apache - 加载 Apache2 mod_xml2enc 时 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30387024/

相关文章:

apache - 来自 Apache/OpenSSL 的 SSL 间歇性 Firefox 和 Python 问题

java - 通过队列发送大文件时 Activemq 内存不足

c++ - 是什么导致 "Undefined symbols for architecture x86_64"构建错误?

node.js - 当通过 Apache ProxyPass 代理时,如何在 Node.JS 上获取远程用户的 IP 地址?

apache - 如何使用 .htaccess 重定向错误的引用?

unix - 在哪里添加 %pre 脚本在 anaconda-ks.cfg 文件中?

android - 在远程 Linux 服务器上运行 aapt

php - Magento 删除菱形问号

c - 架构 x86_64 的 undefined symbol - C