0

我正在尝试将 ZMQ 添加到 c_icap。

这是我的(从库存 makefile 修改)Makefile.am:

pkglib_LTLIBRARIES=srv_bluvector_icap.la
    INCLUDES = -I$(top_srcdir)

    srv_bluvector_icap_la_LIBADD = /usr/local/lib/libzmq.la

    srv_bluvector_icap_la_LIBADD = @MODULES_LIBADD@
    srv_bluvector_icap_la_CFLAGS=  -I../../include/
    srv_bluvector_icap_la_LDFLAGS= -module -avoid-version
    srv_bluvector_icap_la_SOURCES = srv_bluvector_icap.c

EXTRA_DIST= makefile.w32 srv_bluvector_icap.def

这是我运行 make 后的输出(从顶层执行 ./configure 后):

/bin/sh ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../..           -I../../include/ -D_REENTRANT -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -MT srv_bluvector_icap_la-srv_bluvector_icap.lo -MD -MP -MF .deps/srv_bluvector_icap_la-srv_bluvector_icap.Tpo -c -o srv_bluvector_icap_la-srv_bluvector_icap.lo `test -f 'srv_bluvector_icap.c' || echo './'`srv_bluvector_icap.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../include/ -D_REENTRANT -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -MT srv_bluvector_icap_la-srv_bluvector_icap.lo -MD -MP -MF .deps/srv_bluvector_icap_la-srv_bluvector_icap.Tpo -c srv_bluvector_icap.c  -fno-common -DPIC -o .libs/srv_bluvector_icap_la-srv_bluvector_icap.o
mv -f .deps/srv_bluvector_icap_la-srv_bluvector_icap.Tpo .deps/srv_bluvector_icap_la-srv_bluvector_icap.Plo
/bin/sh ../../libtool  --tag=CC   --mode=link gcc -I../../include/ -D_REENTRANT -g -O2 -Wall -D_FILE_OFFSET_BITS=64 -module -avoid-version  -o srv_bluvector_icap.la -rpath /usr/local/lib/c_icap srv_bluvector_icap_la-srv_bluvector_icap.lo  
libtool: link: gcc -Wl,-undefined -Wl,dynamic_lookup -o .libs/srv_bluvector_icap.so -bundle  .libs/srv_bluvector_icap_la-srv_bluvector_icap.o    -O2  
libtool: link: ( cd ".libs" && rm -f "srv_bluvector_icap.la" && ln -s "../srv_bluvector_icap.la" "srv_bluvector_icap.la" )

其中不包含任何 zmq 链接。

当我运行 icap 插件时,我得到了这个:

Loading service :bluvector path srv_bluvector_icap.so
Found handler C_handler for service with extension:.so
Error loading module srv_bluvector_icap.so:dlopen(/usr/local/c-icap/lib/c_icap/srv_bluvector_icap.so, 10): Symbol not found: _zmq_connect
  Referenced from: /usr/local/c-icap/lib/c_icap/srv_bluvector_icap.so
  Expected in: flat namespace
 in /usr/local/c-icap/lib/c_icap/srv_bluvector_icap.so
Error while loading service srv_bluvector_icap.so

我相信这意味着 zmq 没有被链接。

那么,我做错了什么?

4

1 回答 1

2

LIBADD通过设置两次来覆盖变量的值:

srv_bluvector_icap_la_LIBADD = /usr/local/lib/libzmq.la
srv_bluvector_icap_la_LIBADD = @MODULES_LIBADD@

相反,您应该执行以下操作:

srv_bluvector_icap_la_LIBADD = /usr/local/lib/libzmq.la
srv_bluvector_icap_la_LIBADD+= @MODULES_LIBADD@
于 2013-08-27T18:12:51.973 回答