MySQL Forums
Forum List  »  Source, Builds, Binaries

Error linking (libmysqlclient.a)
Posted by: Blaine monkey
Date: December 22, 2010 09:55AM

I'm writting an easy C++ program, it only connects with a mysql database.


It compiles well, but it gives errors linking.

My OS is Fedora 12, and I installed these packages:

MySQL-server-5.5.8-1.linux2.6.i386
MySQL-client-5.5.8-1.linux2.6.i386
MySQL-devel-5.5.8-1.linux2.6.i386

Here is the output:

make all
Building file: ../src/Main.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/mysql -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Main.d" -MT"src/Main.d" -o"src/Main.o" "../src/Main.cpp"
Finished building: ../src/Main.cpp

Building target: mysql_testprog
Invoking: GCC C++ Linker
g++ -L/usr/lib/ -L/usr/lib/mysql -o"mysql_testprog" ./src/Main.o -lmysqlclient -lstdc++ -lz
/usr/lib//libmysqlclient.a(client_plugin.c.o): In function `add_plugin':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/sql-common/client_plugin.c:183: undefined reference to `dlclose'
/usr/lib//libmysqlclient.a(client_plugin.c.o): In function `mysql_load_plugin_v':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/sql-common/client_plugin.c:354: undefined reference to `dlopen'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/sql-common/client_plugin.c:382: undefined reference to `dlsym'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/sql-common/client_plugin.c:374: undefined reference to `dlerror'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/sql-common/client_plugin.c:385: undefined reference to `dlclose'
/usr/lib//libmysqlclient.a(client_plugin.c.o): In function `mysql_client_plugin_deinit':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/sql-common/client_plugin.c:280: undefined reference to `dlclose'
/usr/lib//libmysqlclient.a(charset.c.o): In function `get_charset_name':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/charset.c:533: undefined reference to `pthread_once'
/usr/lib//libmysqlclient.a(charset.c.o): In function `get_charset_number':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/charset.c:521: undefined reference to `pthread_once'
/usr/lib//libmysqlclient.a(charset.c.o): In function `get_charset_by_csname':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/charset.c:638: undefined reference to `pthread_once'
/usr/lib//libmysqlclient.a(charset.c.o): In function `get_charset':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/charset.c:591: undefined reference to `pthread_once'
/usr/lib//libmysqlclient.a(charset.c.o): In function `get_collation_number':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/charset.c:483: undefined reference to `pthread_once'
/usr/lib//libmysqlclient.a(charset.c.o):/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/charset.c:613: more undefined references to `pthread_once' follow
/usr/lib//libmysqlclient.a(my_thr_init.c.o): In function `_my_thread_var':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:449: undefined reference to `pthread_getspecific'
/usr/lib//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_init':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:341: undefined reference to `pthread_getspecific'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:359: undefined reference to `pthread_setspecific'
/usr/lib//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_basic_global_init':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:101: undefined reference to `pthread_mutexattr_init'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:102: undefined reference to `pthread_mutexattr_settype'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:110: undefined reference to `pthread_mutexattr_init'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:111: undefined reference to `pthread_mutexattr_settype'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:120: undefined reference to `pthread_key_create'
/usr/lib//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_basic_global_reinit':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:162: undefined reference to `pthread_getspecific'
/usr/lib//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_end':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:277: undefined reference to `pthread_key_delete'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:279: undefined reference to `pthread_mutexattr_destroy'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:282: undefined reference to `pthread_mutexattr_destroy'
/usr/lib//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_init':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:211: undefined reference to `pthread_create'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:213: undefined reference to `pthread_join'
/usr/lib//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_end':
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:397: undefined reference to `pthread_getspecific'
/export/home/pb2/build/sb_0-2629600-1291401045.22/rpm/BUILD/mysql-5.5.8/mysql-5.5.8/mysys/my_thr_init.c:444: undefined reference to `pthread_setspecific'
collect2: ld returned 1 exit status
make: *** [mysql_testprog] Error 1

What is the problem? How can I do to resolve it?



Edited 1 time(s). Last edit at 12/22/2010 09:56AM by Blaine monkey.

Options: ReplyQuote


Subject
Views
Written By
Posted
Error linking (libmysqlclient.a)
7572
December 22, 2010 09:55AM
2755
December 28, 2010 04:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.