QSqlDatabase: QTDS driver not loaded
I have a program which uses QTDS driver.
in development environment everything works fine. in production i have both the TDS plugin and sybdb available with appropriate rights.
rwxr-xr-x 1 foxprd foxprd 47880 Jan 29 17:33 libqsqltds.so
rwxr-xr-x 1 foxprd foxprd 472579 Jan 29 17:33 libsybdb.so*
they are both inside a directory which has been added to the LD_LIBRARY_PATH
and yet i got
@QSqlDatabase: QTDS driver not loaded@
I aslo can tell that:
points to a directory in which there is an sqldrivers/ directory containing all the libs
If i rename this direcotry in dev I get the same error, if I put it back it works again.
In dev it works if and only if this directory is here. In Prod it does not work in either case. While "MyappDir/" is always listed in the
When a linux app loads it need to be able to access all the libXXX.so it needs. "ld" will look for them in any directory declared in the "LD_LIBRARY_PATH" variable
However Qt seems to load its plugins dynamically from some paths which can be found there:
qDebug() << app.libraryPaths();@
And from one of this path it should load the plugins. So if in qtDir you have
You want to make sure to deploy something like:
this worked fine because the app path is always in "app.libraryPaths()". However, where things get complicated it that libqsqltds.so requires "libsybdb.so.5" to work properly. Which I knew so there also was a
which was wrong because Qt loads dynamically libqsqltds.so but not its dependency, which it seems ld expects to find the usual way ( e.g. in the LD_LIBRARY_PATH )
The fact is that in my dev/integration environments I had libsybdb.so.5 in my path, but not in my production environment.
So whatever Qt plugins you need make sure to copy the plugin directory ( with only the .so inside ) to your production environment. And Also make sure that performing:
will not print any "not found" as these dependency will not appear with: