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

时间:2009-10-29 17:33:25

标签: apache macos

我正在尝试在Mac OS X 10.6上编译mod_transform,但在运行make时遇到ld错误。感谢 diciu 我添加了一些CFLAGS来解决大多数链接问题,但我仍然无法让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

...略...

$ 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

任何人都有其他任何调整来解决这个问题吗?

这是来自http://svn.outoforder.cc/svn/mod_transform/trunk/

的mod_transform

劳伦斯

1 个答案:

答案 0 :(得分:0)

您的 configure 运行似乎无法获得对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

但这通常由 configure 创建的Makefile处理。 尝试通过 configure.log 查看有关未正确设置libxml2的原因的任何线索。