Skip to content
  • Building OCI plugin on Windows

    Solved General and Desktop
    4
    0 Votes
    4 Posts
    207 Views
    SGaistS

    Hi,

    @Zapelniczek said in Building OCI plugin on Windows:

    After deleting file config.cache i was able to build correctly plugin. Plus i had to switch to 32x compiler and qmake to get rid of linking errors for some reason qmake only linked 32x libraries from enviornment variables. Problem solved.

    Likely because only the 32bit versions of the dependencies are located where your environment variables points them.

  • Building OCI plugin on Windows

    Solved General and Desktop
    3
    0 Votes
    3 Posts
    2k Views
    dream_captainD

    @Christian-Ehrlicher
    Thanks for reply.

    After some hours of trying , I finally managed to make a progress, but then got stuck in the linkage stage.

    I decided to give up and downgraded to Qt 5.9.7. QOCI plugin compiled out of the box without any problems.

  • 0 Votes
    4 Posts
    1k Views
    P

    Hi,

    thank you for reply. Will try to reapply only changes as we did in the past in hope it will work.

    Will update this thread if manage to find something out.

  • 0 Votes
    4 Posts
    2k Views
    SGaistS

    http://download.qt.io/official_releases/qt/

    You also have the MaintenanceTool that offers that possibility.

  • 0 Votes
    10 Posts
    4k Views
    SlaneS

    I made several modifications ... but i think the properly modifications are

    In : QtSrc\qtbase\mkspecs\win32-g++\qmake.conf add

    QMAKE_LFLAGS += -static -static-libgcc QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer DEFINES += QT_STATIC_BUILD

    In : QtSrc\qtbase\src\plugins\sqldrivers\oci\oci.pro add

    QMAKE_LFLAGS += oracle_home\oci\lib\msvc\oci.lib QMAKE_LFLAGS += oracle_home\oci\lib\msvc\ociw32.lib QMAKE_LFLAGS += oracle_home\oci\lib\msvc\oraocci11.lib LIBS += -Loracle_home\oci\lib\msvc -loci -lociw32 -loraocci11 INCLUDEPATH += oracle_home\oci\include

    cmd

    -static -debug-and-release -platform win32-g++ -prefix QtPath\Static -I C:\\OpenSSL-Win32\\include -L C:\\OpenSSL-Win32\\lib -opensource -confirm-license -c++std c++14 -nomake examples -skip qtdoc -skip wayland -skip purchasing -skip serialbus -skip qtserialport -skip script -skip scxml -skip speech -skip location -no-opengl -no-angle -qt-zlib -qt-pcre -qt-libpng -no-libjpeg -qt-freetype -sql-oci -I oracle_home\oci\include -L oracle_home\oci\lib\msvc

    try it. the other modifications do not matter

  • 0 Votes
    7 Posts
    3k Views
    SGaistS

    The XXX was meant to be replaced with whatever sql plugin you wanted to have built-in

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

  • 1 Votes
    6 Posts
    12k Views
    GiorgiG

    Ok. I found solution.
    Documentation says

    set INCLUDE=%INCLUDE%;c:\oracle\oci\include
    set LIB=%LIB%;c:\oracle\oci\lib\msvc
    cd %QTDIR%\src\plugins\sqldrivers\oci
    qmake oci.pro
    nmake

    If you are not using a Microsoft compiler, replace nmake with make in the line above.

    but make or nmake didn't work for me. Because I have not installed Microsoft Visual c++ on my machine.

    I made instruction how to do this:

    1 . At first don't forget to install qt sources. During the installation check Sources checkbox.

    2 . then download and install oracle client win32_11gR2_client.zip. choose Runtime option during installation.(even if you are using 64 bit os download 32 bit version on oracle client). It creates c:\app\user\product\client_1... directory

    3 . then open qt minGW command line(start ->all programs -> qt[version] -> [version] -> MinGW [version] -> Qt [version] for Desktop MinGW [version]) and move to the oci source folder:
    cd C:\Qt\Qt[version][version]\Src\qtbase\src\plugins\sqldrivers\oci

    4 . then as documentation says include OCI(Oracle call interface) path and library:
    set INCLUDE=%INCLUDE%;c:\app\user\product[version]\client_1\oci\include
    set LIB=%LIB%;c:\app\user\product[version]\client_1\oci\lib\msvc

    5 . compile oci driver by executing these two lines:
    qmake oci.pro
    mingw32-make
    it will creates two .dll files for you qsqloci.dll(release version) and qsqlocid.dll(debug version)

    6 . last step is to copy these two files into qtcreator installation folder. go to the:
    C:\Qt\Qt[version][version]\Src\qtbase\plugins\sqldrivers
    and copy these files into:
    C:\Qt\Qt[version][version]\mingw[version]\plugins\sqldrivers

    and you are ready to go. to check connection try this code:

    #include <QCoreApplication> #include <QtSql> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QSqlDatabase db = QSqlDatabase::addDatabase("QOCI"); db.setHostName("MY_IP_OR_HOST_NAME"); db.setDatabaseName("XE"); db.setUserName("test"); db.setPassword("test_password"); if (!db.open()) { qDebug() << db.lastError().text(); } else{ qDebug() << "Wow opened"; } return a.exec(); }
  • 0 Votes
    4 Posts
    2k Views
    S

    HI,
    if you use MSVC and not mingw you must replace the line C: \ Qt \ Qt5.4.0 \ Tools \ mingw482_32 \ bin \ mingw32-make.exe by
    nmake (cf Qt documentation)
    and I believe it's not recommended to use Qt 5.4.0 and MSVC,it's better tou use Qt 5.4.1 (binary compatiblity problems with 5.4.0 and MSVC)