web-dev-qa-db-fra.com

Impossible de compiler le plugin mysql Qt 5.6.0 dans Ubuntu 16.04 LTS - 64bit

J'ai récemment mis à niveau Qt vers la version 5.6.0 et mon poste de travail Ubuntu vers la version 16.04 LTS. Maintenant, je sais que je dois recompiler mysql plugin et je l’ai fait avec succès à plusieurs reprises. Cependant, j'avais problème de mise à niveamysql server lors de la mise à niveau de Ubuntu 14.04 LTS vers Ubuntu 16.04 LTS et je l'ai résolu en effectuant une sauvegarde des bases de données et en purgeant et réinstallant mysql server 5.7 depuis Ubuntu 16.04 LTS référentiels, mysql server fonctionne désormais correctement. Ensuite, j'ai essayé de recompiler qt mysql plugin avec:

user@work002:/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql$ clear && make clean && /opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-Lusr/local/lib -lmysqlclient_r" mysql.pro && make all && make install

à partir de Comment construire le plugin QMYSQL sur la documentation officielle d'Unix et OS X et j'obtiens l'erreur suivante de l'éditeur de liens :

rm -f .moc/moc_qsql_mysql_p.cpp
rm -f .moc/main.moc .moc/qsql_mysql.moc
rm -f .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o
rm -f *~ core *.core
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore main.cpp -o .moc/main.moc
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/main.o main.cpp
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore ../../../sql/drivers/mysql/qsql_mysql.cpp -o .moc/qsql_mysql.moc
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o ../../../sql/drivers/mysql/qsql_mysql.cpp
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore ../../../sql/drivers/mysql/qsql_mysql_p.h -o .moc/moc_qsql_mysql_p.cpp
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/moc_qsql_mysql_p.o .moc/moc_qsql_mysql_p.cpp
rm -f libqsqlmysql.so
g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,Origin -Wl,-rpath,\$Origin -Wl,-rpath,\$Origin -Wl,-rpath,\$Origin/../../lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o  -L/usr/local/lib -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -lssl -lcrypto -L/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/lib -lQt5Sql -lQt5Core -lpthread  
/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

Voici également une liste de mysql packages associés , extraits avec Sudo dpkg -l|grep mysql:

ii  libmysqlclient-dev                            5.7.12-0ubuntu1                                     AMD64        MySQL database development files
rc  libmysqlclient18:AMD64                        5.5.49-0ubuntu0.14.04.1                             AMD64        MySQL database client library
ii  libmysqlclient20:AMD64                        5.7.12-0ubuntu1                                     AMD64        MySQL database client library
ii  libmysqlclient20:i386                         5.7.12-0ubuntu1                                     i386         MySQL database client library
rc  libmysqlcppconn7                              1.1.3-5                                             AMD64        MySQL Connector for C++ (library)
ii  libqt4-sql-mysql:i386                         4:4.8.7+dfsg-5ubuntu2                               i386         Qt 4 MySQL database driver
ii  mysql-client-5.7                              5.7.12-0ubuntu1                                     AMD64        MySQL database client binaries
ii  mysql-client-core-5.7                         5.7.12-0ubuntu1                                     AMD64        MySQL database core client binaries
ii  mysql-common                                  5.7.12-0ubuntu1                                     all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server                                  5.7.12-0ubuntu1                                     all          MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.7                              5.7.12-0ubuntu1                                     AMD64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.7                         5.7.12-0ubuntu1                                     AMD64        MySQL database server binaries
rc  mysql-utilities                               1.6.1-2                                             all          collection of scripts for managing MySQL servers
rc  mysql-workbench-community                     6.3.6-1ubu1404                                      AMD64        MySQL Workbench
ii  php-mysql                                     1:7.0+35ubuntu6                                     all          MySQL module for PHP [default]
rc  php5-mysql                                    5.5.9+dfsg-1ubuntu4.16                              AMD64        MySQL module for php5
rc  php5-mysqlnd                                  5.5.9+dfsg-1ubuntu4.14                              AMD64        MySQL module for php5 (Native Driver)
ii  php7.0-mysql                                  7.0.4-7ubuntu2                                      AMD64        MySQL module for PHP

Selon commentaire de l'utilisateur adonis , j'ai changé compilation command en

user@work002:/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql$ make clean && /opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -llibmysqlclient" mysql.pro && make all && make install

et j'obtiens les erreurs suivantes:

rm -f .moc/moc_qsql_mysql_p.cpp
rm -f .moc/main.moc .moc/qsql_mysql.moc
rm -f .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o
rm -f *~ core *.core
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore main.cpp -o .moc/main.moc
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/main.o main.cpp
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore ../../../sql/drivers/mysql/qsql_mysql.cpp -o .moc/qsql_mysql.moc
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o ../../../sql/drivers/mysql/qsql_mysql.cpp
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore ../../../sql/drivers/mysql/qsql_mysql_p.h -o .moc/moc_qsql_mysql_p.cpp
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/moc_qsql_mysql_p.o .moc/moc_qsql_mysql_p.cpp
rm -f libqsqlmysql.so
g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,Origin -Wl,-rpath,\$Origin -Wl,-rpath,\$Origin -Wl,-rpath,\$Origin/../../lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o  -L/usr/local/lib -llibmysqlclient -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -lssl -lcrypto -L/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/lib -lQt5Sql -lQt5Core -lpthread  
/usr/bin/ld: cannot find -llibmysqlclient
/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

Deuxième conseil de l'utilisateur adonis ,

clear && make clean && /opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-Lusr/local/lib -lmysqlclient" mysql.pro && make all && make install,

donne toujours une erreur:

rm -f .moc/moc_qsql_mysql_p.cpp
rm -f .moc/main.moc .moc/qsql_mysql.moc
rm -f .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o
rm -f *~ core *.core
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore main.cpp -o .moc/main.moc
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/main.o main.cpp
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore ../../../sql/drivers/mysql/qsql_mysql.cpp -o .moc/qsql_mysql.moc
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o ../../../sql/drivers/mysql/qsql_mysql.cpp
/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/bin/moc -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/mkspecs/linux-g++ -I/opt/Qt/opensource/64bit/5.5/5.6/Src/qtbase/src/plugins/sqldrivers/mysql -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore ../../../sql/drivers/mysql/qsql_mysql_p.h -o .moc/moc_qsql_mysql_p.cpp
g++ -c -pipe -I/usr/include/mysql -O2 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql/5.6.0/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0 -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore/5.6.0/QtCore -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtSql -I/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/include/QtCore -I.moc -I../../../../mkspecs/linux-g++ -o .obj/moc_qsql_mysql_p.o .moc/moc_qsql_mysql_p.cpp
rm -f libqsqlmysql.so
g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,Origin -Wl,-rpath,\$Origin -Wl,-rpath,\$Origin -Wl,-rpath,\$Origin/../../lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o  -Lusr/local/lib -lmysqlclient -rdynamic -L/usr/lib64/mysql -lmysqlclient_r -lz -lcrypt -lnsl -lm -lssl -lcrypto -L/opt/Qt/opensource/64bit/5.5/5.6/gcc_64/lib -lQt5Sql -lQt5Core -lpthread  
/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

Ce doit être une erreur stupide, mais je ne le trouve tout simplement pas, pourquoi ai-je cette erreur, est-ce que je manque un paquet peut-être?

3
KernelPanic

libmysqlclient_r.so ne fait pas partie de la libmysqlclient in ubuntu 16.04. Vous pouvez créer un lien symbolique vers le libmysqlclient.so compatible avant de lancer votre commande à l'aide de:

Sudo ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
7
user448115

Dans Kubuntu 16.04

cp /opt/Qt/5.5/gcc/plugins/sqldrivers/libqsqlmysql.so /opt/Qt/5.5/gcc/plugins/sqldrivers/libqsqlmysql.so.ori
cp /usr/lib/i386-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so  /opt/Qt/5.5/gcc/plugins/sqldrivers/libqsqlmysql.so
0
rosid