我正在尝试将ZMQ添加到c_icap。
这是我的(从库存文件修改)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没有被链接。
那么,我做错了什么?
答案 0 :(得分: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@