安装mysql_sniffer报错undefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5'问题

Posted makeinstall

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装mysql_sniffer报错undefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5'问题相关的知识,希望对你有一定的参考价值。

按照https://github.com/Qihoo360/mysql-sniffer上的安装方法进行安装,make是报错如下

Linking CXX executable mysql-sniffer
/usr/bin/ld: /root/mysql-sniffer/lib/libgthread-2.0.a(gthread-impl.o): undefined reference to symbol [email protected]@GLIBC_2.2.5
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/mysql-sniffer] Error 1
make[1]: *** [bin/CMakeFiles/mysql-sniffer.dir/all] Error 2
make: *** [all] Error 2

网上查询原因是:

pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。所以在编译中要加 -lpthread参数。

通过查找rdynamic关键字找到文件proj/bin/CMakeFiles/mysql-sniffer.dir/link.txt,并在最后添加了-lpthread,重新make后成功。

/usr/bin/c++   -DENABLE_TCPREASM -O3 -Wall  -DENABLE_TCPREASM -O2    CMakeFiles/mysql-sniffer.dir/main.c.o CMakeFiles/mysql-sniffer.dir/mysql-dissector.c.o CMakeFiles/mysql-sniffer.dir/util.c.o CMakeFiles/mysql-sniffer.dir/session.cpp.o CMakeFiles/mysql-sniffer.dir/sniff-config.cpp.o CMakeFiles/mysql-sniffer.dir/sniff-log.cpp.o  -o mysql-sniffer  -L/root/mysql-sniffer/lib -rdynamic -Wl,-Bstatic -lnidstcpreasm -lnet -lpcap -lglib-2.0 -lgthread-2.0 -Wl,-Bdynamic -lrt -Wl,-Bstatic -lnet -lpcap -lglib-2.0 -lgthread-2.0 -Wl,-Bdynamic -lrt -Wl,-rpath,/root/mysql-sniffer/lib -pthread

 tips:

mysql_sniffer该工具好像只要编译出来可执行文件后,复制到其他主机好像也可以使用。

以上是关于安装mysql_sniffer报错undefined reference to symbol 'pthread_setspecific@@GLIBC_2.2.5'问题的主要内容,如果未能解决你的问题,请参考以下文章

安装nghttp2 报错error: Libtool library used but 'LIBTOOL' is undefined

一键安装lnmp报错 pycurl.so: undefined symbol: CRYPTO_set_locking_callback

关于 报错 undefined symbol: php_json_serializable_ce

revel run报错 undefined: sys call.SIGUSR2"

thinkphp报错Call to undefined method appindexcontrollerIndex::fetch()

php7.2安装pgsql和pdo_pgsql报错/usr/lib64/libldap_r-2.4.so.2: undefined symbol: ber_sockbuf_io_udp的处理...