【问题标题】:C_icap error linking with pthread与 pthread 链接的 C_icap 错误
【发布时间】:2012-09-10 14:41:21
【问题描述】:

我想在 Ubuntu 11 上安装 c_icap 并收到以下错误。

make[2]: Entering directory `/home/madmin/milkyway/sol/server/3rdparty/c_icap-0.1.7/tests'
/bin/bash ../libtool --tag=CC   --mode=link gcc -I../include/ -D_REENTRANT -g -O2 -Wall -rdynamic -rpath /usr/local/c_icap/lib   -o test_cache test_cache.o  **-lpthread** ../libicapapi.la  -ldl
libtool: link: gcc -I../include/ -D_REENTRANT -g -O2 -Wall -rdynamic -o .libs/test_cache test_cache.o  **-lpthread** ../.libs/libicapapi.so -ldl -Wl,-rpath -Wl,/usr/local/c_icap/lib
../.libs/libicapapi.so: undefined reference to `pthread_rwlock_rdlock'
../.libs/libicapapi.so: undefined reference to `pthread_rwlock_wrlock'
../.libs/libicapapi.so: undefined reference to `pthread_rwlock_unlock'
collect2: ld returned 1 exit status

不确定是什么问题,因为我看到了 libicap.so 的 objdump 并得到了这个

0000000000000000         *UND*  0000000000000000              pthread_rwlock_rdlock
0000000000000000       F *UND*  0000000000000000    pthread_mutex_destroy@@GLIBC_2.2.5
0000000000000000         *UND*  0000000000000000              pthread_rwlock_wrlock
0000000000000000       F *UND*  0000000000000000   pthread_mutex_unlock@@GLIBC_2.2.5
0000000000000000         *UND*  0000000000000000              pthread_rwlock_unlock

这表明 pthread lib 没有丢失,因为 pthread_mutex 符号已在 objdump 中正确解析。还存在 -lpthread 标志。

在我拥有的 Makefile 中

THREADS_LDADD = -lpthread
c_icap_LDADD = -lpthread libicapapi.la  -ldl

有什么想法吗?

【问题讨论】:

    标签: c ubuntu linker pthreads glibc


    【解决方案1】:

    使用-pthread 编译。

    这将包括所有需要的内容。

    【讨论】:

      猜你喜欢
      • 2014-03-26
      • 2013-12-29
      • 2011-09-14
      • 2015-06-29
      • 2017-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多