Important: Please read the Qt Code of Conduct -

Compiling OCI driver

  • Hello, I need help with compiling OCI driver
    I am trying to do it about a week

    I've got 2 Oracle clients: Instant 11.2.0 and Express 11g
    Working at Qt 5.9.1

    Trying to compile drivers with next ways:

    cd D:\Qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\oci
    qmake -- OCI_INCDIR=D:\app\Master\product\11.2.0\client_1\oci\include OCI_LIBDIR=-LD:\app\Master\product\11.2.0\client_1\oci\lib\msvc
    nmake or mingw32-make

    cd D:\Qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\oci
    qmake "INCLUDEPATH+=D:\app\Master\product\11.2.0\client_1\oci\include" "LIBS+=-LD:\app\Master\product\11.2.0\client_1\oci\lib\msvc -loci"
    nmake or mingw32-make
    cd D:\Qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\oci
    qmake "INCLUDEPATH+=C:\oraclexe\app\oracle\product\11.2.0\server\oci\include" "LIBS+=-LC:\oraclexe\app\oracle\product\11.2.0\server\oci\lib\MSVC -loci"
    nmake or mingw32-make

    As a result, I have big pack of "undefined reference to OCI..."


    TARGET = qsqloci
    HEADERS += $$PWD/qsql_oci_p.h
    SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp
    QMAKE_USE += oci
    darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
    OTHER_FILES += oci.json

    What should I do to get this driver?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Looks like you are trying to link an MSVC built library to a MinGW build of Qt. Unless it's pure C code, that's not possible. You should also check the architecture of the library you are trying to link to.

  • Probably, I've tryed to do it with VC15 nmake via Win cmd and VC15 cmd
    Which specifically file should I check?

  • Lifetime Qt Champion

    From the log you posted, you are still using MinGW.

    You should also check whether that library is 32 or 64 bit.

  • Sorry for stupid questions, I am new at this.
    I am looking at other topicks, and there's driver compiled by minGW with the same method
    So I should add VC cmp & dbg into project?
    Cause I trying to complie with nmake, but it refers to g++
    Now I've got Qt5.9.1( MinGW5.3.0 and MSVC15) and Oracle 11gR2 as Runtime
    Wha should I do next?

  • Lifetime Qt Champion

    The key word is coherence: you can't mix and match C++ libraries built with different compilers on Windows. The only exception currently is VS2017 that is compatible with VS2015.

    So what I'm suggesting is that you ensure that you have your dependencies built using the same compiler as your Qt version and for the same architecture.

  • I am back and my problem is still actual
    Now I am using Qt 5.11 + MSVC15, ofcourse with MS SDK 8.1
    Trying to compile oci.dll I've got two results: "Library 'oci' is not defined" or “Cannot open include file: 'windows.h'
    Using this commands:

    cd C:\Qt\Qt5.11.0\5.11.0\Src\qtbase\src\plugins\sqldrivers\oci
    qmake -- OCI_INCDIR=C:\oraclexe\app\oracle\product\11.2.0\server\oci\include OCI_LIBDIR=C:\oraclexe\app\oracle\product\11.2.0\server\oci\lib\MSVC

    Please, help me to fix this problem

  • Lifetime Qt Champion

    Are you doing that in a Visual Studio enabled command line ?
    Are you sure that you have the libraries for the correct architecture ?

  • Did anybody solve the issue?
    @SGaist What do you advice?
    @Zipazar Did you solve the problem?
    Can you help me?

Log in to reply