更新时间:2022-03-24 22:24:56
永远永远通过符号链接解决这类问题.如果您的系统没有提供库或可执行文件所需的确切 soname,您将需要重新编译该库或可执行文件.库在其文件名中包含 soname 版本号是有原因的,不匹配的 soname 将导致动态链接器/加载器not found
.您只是通过为库插入损坏的 soname 来破坏该过程和您的整个系统.
Never ever solve that kind of problems via symlinking. If your system does not provide the exact soname required by a library or an executable, you'll need to recompile that library or executable. There is a reason why libraries have the soname version number in their file names, and a mismatching soname will result in a not found
for the dynamic linker/loader. You're just breaking that process and your entire system by inserting a broken soname for a library.
那么,如何重新编译插件使其在 Ubuntu 上运行?
(或者,实际上,任何地方.甚至 Windows 或 Mac.只需调整说明)
(Or, actually, anywhere. Even Windows or Mac. Just adapt the instructions)
循序渐进:
libmysqlclient-dev
包,但请仔细检查是否在您的特定 Ubuntu 版本上更改了名称.继续 https://packages.ubuntu.com 并使用基于文件的搜索来查找 mysql.h
.INSTALL_DIR/Src/5.7/qtbase/src/plugins/sqldrivers/mysql
(根据实际情况调整INSTALL_DIR
和5.7
).qmake
.正确的是来自相同 Qt 安装的版本,并且其版本与源代码匹配.在您的情况下,它可能位于 INSTALL_DIR/5.7/gcc_64/bin/qmake
中.make
.如果由于找不到某个库而导致编译失败,请在您的系统上安装所需的软件包.上面链接的 Ubuntu 软件包搜索可能有用.make
运行成功,它会创建一个全新的libqsqlmysql.so
.它应该会自动覆盖 INSTALL_DIR/5.7/gcc_64/plugins/sqldrivers
中的那个.如果出于某种原因它没有被自动覆盖,请手动将其移到那里.libmysqlclient-dev
package, but double check in case the name changed on your particular Ubuntu edition. Go on https://packages.ubuntu.com and use the file-based search to look for mysql.h
.INSTALL_DIR/Src/5.7/qtbase/src/plugins/sqldrivers/mysql
(adjust INSTALL_DIR
and 5.7
to your actual case).qmake
. The right one is the one coming from the same installation of Qt, and whose version matches the sources. In your case it's likely to be in INSTALL_DIR/5.7/gcc_64/bin/qmake
.make
. If it fails to compile due to some library not found, install the required packages on your system. The Ubuntu package search linked above may be useful.make
runs successfully, it will create a brand new libqsqlmysql.so
. It should automatically overwrite the one in INSTALL_DIR/5.7/gcc_64/plugins/sqldrivers
. If for any reason it's not automatically overwritten, move it manually there.完成!享受您的 MySQL 数据库连接.
Done! Enjoy your MySQL database connection.