Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Building OCI plugin on Windows



  • Hi, i'm trying to build a QOCI plugin with Qt 5.11.2 x32bit according to this guide http://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-oci-plugin-on-windows

    Steps i've taken:

    1. Installed msvc2015 build tools

    2. Downloaded and unpacked Oracle instantclient-basic-nt-12.2.0.1.0.zip and instantclient-sdk-nt-12.2.0.1.0.zip

    3. Set path variables:
      ORACLE_HOME=C:\instantclient_12_2
      added to PATH: E:\QtOnline\5.11.2\msvc2015\bin; C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

    4. cd E:\QtOnline\5.11.2\Src\qtbase\src\plugins\sqldrivers

    5. Ran qmake

    qmake -- OCI_INCDIR=C:\instantclient_12_2\sdk\include OCI_LIBDIR=C:\instantclient_12_2\sdk\lib\msvc
    

    OR

    E:\QtOnline\5.11.2\msvc2015\bin\qmake.exe -- OCI_INCDIR="C:\instantclient_12_2\sdk\include" OCI_LIBDIR="C:\instantclient_12_2\sdk\lib\msvc"
    

    Configure summary:
    Qt Sql:
    DB2 (IBM) .............................. no
    InterBase .............................. no
    MySql .................................. no
    OCI (Oracle) ........................... no
    ODBC ................................... no
    PostgreSQL ............................. no
    SQLite2 ................................ no
    SQLite ................................. yes
    Using system provided SQLite ......... no
    TDS (Sybase) ........................... no

    config.log contains these lines:

    looking for library oci
    Trying source 0 (type inline) of library oci ...
    + cd /d E:\QtOnline\5.11.2\Src\qtbase\src\plugins\sqldrivers\config.tests\oci && E:\QtOnline\5.11.2\msvc2015\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\opensslx86\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresqlx86\\pgsql\\lib" "INCLUDEPATH += C:\\opensslx86\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresqlx86\\pgsql\\include" "LIBS += -loci" E:/QtOnline/5.11.2/Src/qtbase/src/plugins/sqldrivers/config.tests/oci
    + cd /d E:\QtOnline\5.11.2\Src\qtbase\src\plugins\sqldrivers\config.tests\oci && set MAKEFLAGS=& nmake
    > Microsoft (R) Program Maintenance Utility Version 14.00.24234.1
    > Copyright (C) Microsoft Corporation.  All rights reserved.
    > 	cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W0 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DNDEBUG -I. -IC:\opensslx86\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresqlx86\pgsql\include -IE:\QtOnline\5.11.2\msvc2015\mkspecs\win32-msvc -Fo @C:\Users\sp\AppData\Local\Temp\nmD757.tmp
    > main.cpp
    > .\main.cpp(2): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory
    > NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.EXE"' : return code '0x2'
    > Stop.
     => source failed verification.
    Trying source 1 (type inline) of library oci ...
      => source failed condition '!config.win32'.
    test config.sqldrivers.libraries.oci FAILED
    

    It's confusing because the file is located in C:\instantclient_12_2\sdk\include. Seems like flags OCI_INCDIR and OCI_LIBDIR are not used by qmake correctly.


  • Lifetime Qt Champion

    Did you try to use forward slashes for OCI_INCDIR and OCI_LIBDIR? And please don't quote the paths:

    qmake.exe -- OCI_INCDIR=C:/instantclient_12_2/sdk/include OCI_LIBDIR=C:/instantclient_12_2/sdk/lib/msvc



  • @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.


Log in to reply