You can use QPluginLoader to get the best error message.
When I had the same problem with the MySQL driver, the message was like "The version was compiled with parameters other than this version of Qt."
It seemed that the Qt sources shipped with the Qt SDK at that time were not compatible with its binary files.
After loading Qt sources and compiling my own version of Qt and the MySQL driver, the problem disappeared.
EDIT: some sample code.
QPluginLoader loader; loader.setFileName("/Users/niklaswulf/QtSDK/Qt/4.8.4/plugins/sqldrivers/libqsqlite_debug.dylib"); qDebug() << loader.load(); qDebug() << loader.errorString(); loader.setFileName("/Users/niklaswulf/QtSDK/Qt/5.0.1/5.0.1/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib"); qDebug() << loader.load(); qDebug() << loader.errorString();
When compiling against 5.0.1, this is the result:
false "The file '/Users/niklaswulf/QtSDK/Qt/4.8.4/plugins/sqldrivers/libqsqlite_debug.dylib' is not a valid Qt plugin." true "Unknown error"
I also found an old post:
The plugin '/path/to/some/libqsqlmysql.dylib' uses incompatible Qt library. Expected build key "macosx macx-cocoa g++-4 full-config", got "macosx macx-cocoa g++-4 no-pkg-config"
source share