开发者

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:

  1. installed QT 4.7 SDK

  2. 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

  3. 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

  4. then on the Qt dir:

    configure -static -release

    nmake sub-src

  5. 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:

  1. Extract the qt sources for your static Qt version, lets say in C:\Qt\4.7.0-static

  2. Change qmake.conf the way you already did.

  3. 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

  4. Do a nmake sub-src

  5. 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)

  6. It hopefully works now - using the -qt-sql-oci switch causes a static build of the oci driver.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜