How to run project OCI



  • Hello,

    I'm trying to compile the project OCI using Qt 5.8 on a Windows 7 - 64 bit machine, compiler VS2015.
    When I open this project (D:\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci) the following message is returned immediately: "Project ERROR: Library 'oci' is not defined."

    Oracle installation: D:\Oracle\product\12.1.0\client_1\oci

    • sub directories:
      • include (cpp headers)
      • lib
        • msvc
        • directory: vc10, vc11 and vc12
        • files: oci, ociw32, oraocci12

    Does anyone have faced similar problem and know how to fix it, please?

    Thanks in advance


  • Lifetime Qt Champion

    HI,

    First thing I see (but not related to the current error you have) is that, unless I'm mistaken, you don't have any version of these libs for VS2015.

    Also I'm not yet used to the modifications made to the Qt build system but you may need to set these variables:

    QMAKE_LIBS_OCI
    QMAKE_LIBDIR_OCI
    QMAKE_INCDIR_OCI
    

    or if it doesn't change anything, take a look at the QOCI documentation.

    Hope it helps



  • I've got the same issue with basically the same setup, just on Windows 8.1 and Oracle 11 (same compiler, same Qt version, similar paths).
    I've set up the LIB and INCLUDE variables properly, but it won't work.

    I've tracked it down to the following line in the oci project file:

    QMAKE_USE += oci
    

    If I replace this line by

    QMAKE_LFLAGS += oci.lib
    

    qmake + nmake run successfully.
    I would prefer being able to translate the plugin without modifications, however.
    Setting the mentioned QMAKE_*_OCI fields does not seem to help unfortunately.

    [Edit:] It obviously works as well if I remove the QMAKE_USE line and call

    qmake "LIBS+=-loci" oci.po
    

    from the command line, but this still requires modifying the Qt sources.


  • Lifetime Qt Champion

    There's QTBUG-58372 that proposes an alternative.



  • @SH86 said in How to run project OCI:

    er being able to translate the plugin without modifications, however.
    Setting the mentioned QMAKE_*_OCI fields does not seem to help unfo

    You're right. Replacing QMAKE_USE "mutes" the error.



  • We managed to build QSQLOCI now by adding -sql-oci to the configure call when building Qt itself, rather than building the plugin in a separate step (we did this due to problems with earlier Qt versions).

    It seems that the qmake.exe created by the configure call (I believe) defines the available QMAKE_USE options somehow



  • File oci.pro:

    # file: oci.pro
    TARGET = qsqloci
    
    HEADERS += $$PWD/qsql_oci_p.h
    SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp
    
    # QMAKE_USE += oci  # Library 'oci' is not defined.
    QMAKE_LFLAGS += oci.lib
    
    darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ
    
    OTHER_FILES += oci.json
    
    PLUGIN_CLASS_NAME = QOCIDriverPlugin
    include(../qsqldriverbase.pri)
    

    Directory: D:\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci

    Files (project + oracle headers):
    main.cpp
    nzerror.h
    nzt.h
    occi.h
    occiAQ.h
    occiCommon.h
    occiControl.h
    occiData.h
    occiObjects.h
    oci.h
    oci.json
    oci.lib
    oci.pro
    oci.pro.user
    oci1.h
    oci8dp.h
    ociap.h
    ociapr.h
    ocidef.h
    ocidem.h
    ocidfn.h
    ociextp.h
    ocikpr.h
    ociw32.lib
    ocixml.h
    ocixmldb.h
    ocixstream.h
    odci.h
    oraocci12.lib
    oraocci12d.lib
    oratypes.h
    ori.h
    orid.h
    orl.h
    oro.h
    ort.h
    qsql_oci.cpp
    qsql_oci_p.h
    README
    xa.h

    Issues when compiling using Qt Creator 4.2.1:

    C4267: '=': conversion from 'size_t' to 'ub2', possible loss of data
    D:\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci\qsql_oci.cpp

    LNK1181: cannot open input file 'oci.lib'

    C4267: '=': conversion from 'size_t' to 'ub2', possible loss of data
    D:\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci\qsql_oci.cpp

    LNK1181: cannot open input file 'oci.lib'


  • Lifetime Qt Champion

    The fact that the lib is in the source folder doesn't mean that the linker can find it.

    You have to adjust LIBS to give information about the location of the .lib file.



  • @SGaist Can you help on how to do that, please?


  • Lifetime Qt Champion

    LIBS += -Lpath/to/folder_containing_the_lib_file/

    A quick look at the LIBS variable documentation would have got you the answer quicker.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.