After MySQL driver installation now also I am facing problem
-
Hello Friends,
I have installed MySQL driver using following command in shell:
@qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/i386-linux-gnu/libmysqlclient.a" mysql.pro
make
make install@After that It has been installed without any error. Now I want to run a program but not able to run it because it comes up with a problem:
@./sqlexample: symbol lookup error: /home/pkr/QtSDK/Desktop/Qt/473/gcc/plugins/sqldrivers/libqsqlmysql.so: undefined symbol: mysql_server_init@
-
The plugin cannot find the named MySQL dynamic library because it is not on a standard system path (or in a path specified in LD_LIBRARY_PATH). Given the odd library path you have used while trying to build the plugin I am not surprised. MySQL on a typical 32-bit Linux will install its headers into /usr/include/mysql and libraries into /usr/lib and it will Just Work(tm). You have done something unusual to end up with the MySQL link library in a location generally used for component libraries of GCC: we can only guess at what.
-
Thanks for the reply Chris. However, I got my header files for mysql in /usr/include/mysql but there was no library file in /usr/lib.
So, I tried to locate libmysqlclient.so in shell and got the path
/usr/lib/i386-linux-gnu/
That's why I used that path. Can you tell me if I will copy the library files from someone else PC. Can I make it work. -
Copying files around or from another machine before you understand why it is failing is just thrashing around in the dark.
There's nothing wrong with the library. It just appears to be in a place that is not usually on the path searched by the system for libraries.
Before you try fixing this permanently, try running your example with this command line:
@LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu ./sqlexample@Does it work? If so, read the man page for ldconfig to see how to make it permanent.