how to deploy qt based application with oracle plugin
just wrote application based QT with OCI plugin but i can't deploy it. i did the following steps:
installed QT 4.7 SDK
Installed the OCI plugin:
set INCLUDE=%INCLUDE%;c:\oracle\oci\include
set LIB=%LIB%;c:\oracle\oci\lib\msvc
cd %QTDIR%\src\plugins\sqldrivers\oci
qmake -o Makefile oci.pro
nmake
i followed: "Building static Qt on Windows with MSVC" edited the \mkspecs\win32-X\qmake.conf:
QMAKE_CFLAGS_RELEASE = -O2 -MT
CONFIG += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target
then on the Qt dir:
configure -static -release
nmake sub-src
i'm not sure about th开发者_如何学Pythone next steps but in my application dir i ran:
qmake -o Makefile myProgram.pro
nmake
i get .exe file in release but i get error that the OCI driver is not loaded... please assist me , i had no errors in any step i made
Shouldn't you first compile your static version of Qt and then compile the OCI plugin? You could also do this in one step by setting the appropriate configure switch -qt-sql-oci and adding the required include and lib dirs.
Because, in your scenario, which qmake did you use to compile your OCI plugin? The static one you intend to use for your app isn't build yet. So it seems your OCI plugin was build with one Qt version, whereas your application uses another (static) Qt version. This mismatch is most probably the cause of your problem.
Also, when using static plugins, you have to use the Q_IMPORT_PLUGIN
macro. See here for more details http://doc.qt.io/archives/qt-4.7/plugins-howto.html#static-plugins
As requested, here a step by step instruction how it should work:
Extract the qt sources for your static Qt version, lets say in C:\Qt\4.7.0-static
Change qmake.conf the way you already did.
In your visual studio command line, change directory to C:\Qt\4.7.0-static and do this:
configure -static -release -qt-sql-oci -I C:\oracle\oci\include -L c:\oracle\oci\lib\msvc
Do a nmake sub-src
Then, change the qt version you use for your app to the one just compiled and execute "Run qmake" and "Rebuild project" from the build menu in QtCreator (as you installed Qt SDK, I'm assuming you're using it)
It hopefully works now - using the -qt-sql-oci switch causes a static build of the oci driver.
精彩评论