我试图按照QSqlDatabase: QMYSQL driver not loaded on Ubuntu 15.04 64bits
中给出的答案在Xubuntu 16.04上,其中:
# ls /usr/lib/x86_64-linux-gnu/libmysql* -ls
5624 -rw-r--r-- 1 root root 5757198 Abr 21 10:30 /usr/lib/x86_64-linux-gnu/libmysqlclient.a
0 lrwxrwxrwx 1 root root 20 Abr 21 10:29 /usr/lib/x86_64-linux-gnu/libmysqlclient.so -> libmysqlclient.so.20
0 lrwxrwxrwx 1 root root 24 Abr 21 10:29 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20 -> libmysqlclient.so.20.2.1
4140 -rw-r--r-- 1 root root 4237408 Abr 21 10:30 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.2.1
此处没有*_r
个已终止的文件。
但是,make
似乎会搜索*_r
个已终止的文件:
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: error: ld returned 1 exit status
Makefile:111: recipe for target '../../../../plugins/sqldrivers/libqsqlmysql.so' failed
make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
从What is difference between libmysqlclient.a and libmysqlclient_r.a?来看,两者之间似乎只是一个联系。这是正确的方法吗?我应该像以下一样手动完成:
cd /usr/lib/x86_64-linux-gnu/
ln -s libmysqlclient.so.20.2.1 libmysqlclient_r.so.20.2.1
ln -s libmysqlclient.so.20 libmysqlclient_r.so.20
ln -s libmysqlclient.so libmysqlclient_r.so
ln -s libmysqlclient.a libmysqlclient_r.a
或者我错过了什么?