在Mac OS X上编译apache模块mod_转换的未定义符号

在Mac OS X上编译apache模块mod_转换的未定义符号,apache,macos,Apache,Macos,我试图在MacOSX10.6上编译mod_转换,但在运行make时出现了一个ld错误。多亏了diciu,我添加了一些CFLAG,解决了大多数链接问题,但我仍然无法使apreq2链接正常工作 $ CFLAGS="-lxml2 -lxslt -L/opt/local/lib -lapreq2" ./configure --with-apr=/opt/local/bin/apr-1-config --with-apr-util=/opt/local/bin/apu-1-config --with-ap

我试图在MacOSX10.6上编译mod_转换,但在运行make时出现了一个ld错误。多亏了diciu,我添加了一些CFLAG,解决了大多数链接问题,但我仍然无法使apreq2链接正常工作

$ CFLAGS="-lxml2 -lxslt -L/opt/local/lib -lapreq2" ./configure --with-apr=/opt/local/bin/apr-1-config --with-apr-util=/opt/local/bin/apu-1-config --with-apxs=/opt/local/apache2/bin/apxs --with-apreq2=/opt/local/bin/apreq2-config $CFLAGS=“-lxml2-lxslt-L/opt/local/lib-lapreq2”。/configure--with-apr=/opt/local/bin/apr-1-config--with-apr-util=/opt/local/bin/apu-1-config--with-apxs=/opt/local/apache2/bin/apxs--with-apreq2=/opt local/bin/apreq2-config …剪断

$ make $ make Making all in src /opt/local/share/apr-1/build/libtool --tag=CC --mode=link gcc -Wall -I../include -I/usr/local/include -I/usr/local/include/libxml2 -O2 -arch x86_64 -I/opt/local/include -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -I/opt/local/apache2/include -I/opt/local/include/apr-1 -I/opt/local/include/apr-1 -I/opt/local/include -O2 -arch x86_64 -I/opt/local/include -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -I/opt/local/apache2/include -I/opt/local/include/apr-1 -I/opt/local/include -I/opt/local/include/apr-1 -I/opt/local/include/apreq2 -I/opt/local/include/apr-1 -I/opt/local/include -lxml2 -lxslt -L/opt/local/lib -lapreq2 -module -export-dynamic -avoid-version -no-undefined /opt/local/lib/libapreq2.la -L/opt/local/lib -laprutil-1 -L/opt/local/lib/db46 -L/opt/local/lib -lapr-1 -lpthread -ldb-4.6 -lexpat -liconv -o http.la -rpath /opt/local/apache2/modules/mod_transform http_la-http.lo /usr/bin/gcc-4.2 -o .libs/http.so -bundle .libs/http_la-http.o -lxml2 -lxslt -L/opt/local/lib /opt/local/lib/libapreq2.dylib -L/opt/local/lib/db46 /opt/local/lib/libaprutil-1.dylib /opt/local/lib/libapr-1.dylib -lpthread /opt/local/lib/db46/libdb-4.6.dylib /opt/local/lib/libexpat.dylib /opt/local/lib/libiconv.dylib -arch x86_64 -arch x86_64 Undefined symbols: "_apreq_handle_apache2", referenced from: _transform_run_begin in http_la-http.o _filter_init in http_la-http.o ld: symbol(s) not found collect2: ld returned 1 exit status make[1]: *** [http.la] Error 1 make: *** [all-recursive] Error 1 $make $make 在src中制作所有 /opt/local/share/apr-1/build/libtool--tag=CC--mode=link gcc-Wall-I../include-I/usr/local/include-I/usr/local/libxml2-O2-arch x86_-64-I/opt/local/include-DDARWIN-DSIGPROCMASK\u-set\u-THREAD\u-MASK-no-cpp-precomp-I/opt/local/apache2/include/apr-1-I/opt/local/include/apr-1-1-1-I/opt/local/include/include-O2-O2-archx86_64-I/opt/local/include-DDARWIN-DSIGPROCMASK\u-THREAD\u-MASK-no-cpp precomp-I/opt/local/apache2/include-I/opt/local/include/apr-1-I/opt/local/include/apr-1-I/opt/local/include/apreq2-I/opt/local/include-lxml2-lxslt-L/local/lib-lapreq2-模块-导出动态-避免版本-没有未定义的/opt/local/lib/libapreq2.la-L/opt/local/lib-laprutil-1-L/opt/local/lib/db46-L/opt/local/lib-lapr-1-lpthread-ldb-4.6-lexpat-liconv-o http.la-rpath/opt/local/apache2/modules/modules/modu transform http_la-http.lo /usr/bin/gcc-4.2-o.libs/http.so-bundle.libs/http_la-http.o-lxml2-lxslt-L/opt/local/lib/opt/local/libapreq2.dylib-L/opt/local/lib/libaprutil-1.dylib/opt/local/libapr-1.dylib-1.dylib-lpthread/opt/local/libdb-4.6.dylib/opt/local/lib/lib/lib/lib/lib/lib/lib/lib/libiconv-64-x86 未定义的符号: “_apreq_handle_apache2”,引用自: _在http\u la-http.o中转换\u运行\u开始 _http_la-http.o中的filter_init ld:找不到符号 collect2:ld返回了1个退出状态 生成[1]:***[http.la]错误1 make:**[all recursive]错误1 有人有任何其他调整来解决这个问题吗

这是来自的mod_变换

Laurence

看起来您的配置运行无法检测到对libxml2的依赖:

nm -arch x86_64 /usr/lib/libxml2.dylib | grep _xmlXPathNewFloat
    0000000000054896 T _xmlXPathNewFloat
要修复编译,您可以在gcc中添加“-lxml2”,即:

/usr/bin/gcc-4.2 -o .libs/http.so -bundle .libs/http_la-http.o ... -lxml2
但这通常由配置创建的Makefile处理。 请尝试通过configure.log查找libxml2设置不正确的原因