这是构建日志,任何人都可以提供帮助吗?
gcc -DHAVE_CONFIG_H -DHAVE_VERSION_H -DLIBRARY_DIR="\"/usr/local/lib\"" -DSBIN_DIR="\"/usr/local/sbin\"" -I. -I.. -I../zmq/include -g -D_REENTRANT -D__EXTENSIONS__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -w -pedantic -std=gnu99 -I../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/include -c -o dbtool.o dbtool.c
gcc -o dbtool dbtool.o -g -O2 -Wall -W -Wshadow -pedantic -std=gnu99 -Wl,--export-dynamic -ldl -lpthread -lstdc++ -lrt -luuid -L../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib -lmysqlclient -lm
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_init':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:121: undefined reference to `pthread_key_create'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_init':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:317: undefined reference to `pthread_getspecific'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_init':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:335: undefined reference to `pthread_setspecific'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_destroy_mutex':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:260: undefined reference to `pthread_getspecific'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_init':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:317: undefined reference to `pthread_getspecific'
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:335: undefined reference to `pthread_setspecific'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_end':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:374: undefined reference to `pthread_getspecific'
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:422: undefined reference to `pthread_setspecific'
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:407: undefined reference to `pthread_setspecific'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `_my_thread_var':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:428: undefined reference to `pthread_getspecific'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_var_mutex_in_use':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:446: undefined reference to `pthread_getspecific'
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `_my_thread_var':
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:428: undefined reference to `pthread_getspecific'
答案 0 :(得分:3)
您需要在引入依赖项的mysql库之后指定pthreads库。链接语句从左到右解析,如果在引入依赖项的对象之前指定库,它将被丢弃。