mysql plugin not compiling from source
i have qt 5.2.1 in centos6.6 (32 bit) linux, in vmware machine. mysql in another VM. mysql is connection from client
to server is successful. But when i want to build plugin for mysql database connectivity by command :
Code:
# /opt/Qt5.2.1/5.2.1/gcc/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
# make
this gives following error :
Code:
/export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/mysys/my_getsystime.c:44: undefined
reference to `clock_gettime'
collect2: error: ld returned 1 exit status
make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
how to solvw this
Re: mysql plugin not compiling from source
Try adding librt to the linker:
Code:
# /opt/Qt5.2.1/5.2.1/gcc/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r -lrt" mysql.pro
Re: mysql plugin not compiling from source
this " -lrt" adding give following error:-
-------------------------------------------
Code:
/usr/lib/mysql/libmysqlclient_r.a(client_plugin.c.o): In function `do_add_plugin':
/export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:179:
undefined reference to `dlclose'
/usr/lib/mysql/libmysqlclient_r.a(client_plugin.c.o): In function `mysql_client_plugin_deinit':
/export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:306:
undefined reference to `dlclose'
/usr/lib/mysql/libmysqlclient_r.a(client_plugin.c.o): In function `mysql_load_plugin_v':
/export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:393:
undefined reference to `dlopen'
/export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:422:
undefined reference to `dlsym'
/export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:413:
undefined reference to `dlerror'
/export/home/pb2/build/sb_0-14135570-1421675634.15/rpm/BUILD/mysql-5.6.23/mysql-5.6.23/sql-common/client_plugin.c:425:
undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
Re: mysql plugin not compiling from source
this is not the result of adding librt.
Adding librt solved the error you posted at first, now you are having another lib missing:
Now you have to add '-ldl'.
And if you continue getting such errors, google for the functions which the linker is complaining about and see in which lib they are defined, and add them to you linker line until all the dependencies are satisfied.
Re: mysql plugin not compiling from source
Thanks high_flyer, you solved my problem. I added -lrt and -ldl like this:-
Code:
# /opt/Qt5.2.1/5.2.1/gcc/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r -lrt -ldl" mysql.pro
#make
# make install
and the problem was gone.
And finally tell me how to set this thread as SOLVED.