Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem building OCI plugin for Qt 5.9.1

Problem building OCI plugin for Qt 5.9.1

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 7.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RocioMartinez13
    wrote on last edited by
    #1

    Hello!

    I am trying to connect to an Oracle database using OCI but when I try to build the OCI plugin it is giving me some problems...

    Windows 64 bits
    Qt version installed is 5.9.1
    MinGW 5.3.0 32 bits that I installed along with Qt
    Instant Client SDK 12.2 for an Oracle Database 12c

    I modified the oci.pro to include the library oci.lib so I put the following lines:

    INCLUDEPATH += C:\Oracle\instantclient_12_2\sdk\lib\msvc
    C:\Oracle\instantclient_12_2\sdk\include \

    #QMAKE_USE += oci
    QMAKE_LFLAGS += -L"C:\Oracle\instantclient_12_2\sdk\lib\msvc" -loci \

    The commands I am using are:

    set INCLUDE = %INCLUDE%;C:\Oracle\instantclient_12_2\sdk\include
    set PATH = %PATH%;C:\Oracle\instantclient_12_2\sdk\lib\msvc
    cd %QTDIR% C:\Qt\5.9.1\Src\qtbase\src\plugins\sqldrivers\oci
    qmake oci.pro
    nmake (but I have also tried using mingw32-make)

    Everything good till the nmake, where I get many errors like the following:

    .obj/release/qsql_oci.o:qsql_oci.cpp:(.text+0xa5d0): undefined reference to _OCINumberToInt' .obj/release/qsql_oci.o:qsql_oci.cpp:(.text$_ZN17QSqlDriverPrivateD0Ev[__ZN17QSqlDriverPrivateD0Ev]+0x2a): undefined reference to __ZdlPvj'
    [...]
    .obj/release/moc_qsql_oci_p.o:moc_qsql_oci_p.cpp:(.rdata$_ZTI10QOCIDriver[__ZTI10QOCIDriver]+0x0): undefined reference to `__ZTVN10__cxxabiv120__si_class_type_infoE'
    collect2: error: ld returned 1 exit status
    NMAKE : fatal error U1077: 'C:\cygwin64\bin\g++.EXE' : return code '0x1'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\nmake.exe"' : return code '0x2'
    Stop.

    Where with the mingw32-make I get this:

    [...]
    collect2: error: ld returned 1 exit status
    Makefile.Release:67: recipe for target '..\plugins\sqldrivers\qsqloci.dll' failed
    mingw32-make[1]: *** [..\plugins\sqldrivers\qsqloci.dll] Error 1
    mingw32-make[1]: Leaving directory 'C:/Qt/5.9.1/Src/qtbase/src/plugins/sqldrivers/oci'
    Makefile:40: recipe for target 'release-all' failed

    Any idea of what I am doing wrong? Thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi and welcome to devnet,

      Can you share your .pro file ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RocioMartinez13
        wrote on last edited by
        #3

        Hello!

        Thank you!

        My .pro file is:

        TARGET = qsqloci

        HEADERS += $$PWD/qsql_oci_p.h
        SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp

        INCLUDEPATH += C:\Oracle\instantclient_12_2\sdk\lib\msvc
        C:\Oracle\instantclient_12_2\sdk\include \

        #QMAKE_USE += oci
        QMAKE_LFLAGS += -L"C:\Oracle\instantclient_12_2\sdk\lib\msvc" -loci \

        darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ

        OTHER_FILES += oci.json

        PLUGIN_CLASS_NAME = QOCIDriverPlugin
        include(../qsqldriverbase.pri)

        Where qsqldriverbase.pri was giving me problems in the line:

        QT = core core-private sql-private

        # For QMAKE_USE in the parent projects.
        #include($$shadowed($$PWD)/qtsqldrivers-config.pri)

        PLUGIN_TYPE = sqldrivers
        load(qt_plugin)

        DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII

        I commented the include of that file because it was not finding it.

        Waiting for your reply. Thank you in advance!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You should use forward slashes in your path. Qt handles the conversion for you.

          Also you have backslashes scatered over that file without anyhting that follows which might break the parsing.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • R Offline
            R Offline
            RocioMartinez13
            wrote on last edited by
            #5

            I modified that, now my .pro looks like:

            TARGET = qsqloci

            HEADERS += $$PWD/qsql_oci_p.h
            SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cpp

            INCLUDEPATH += C:/Oracle/instantclient_12_2/sdk/lib/msvc
            C:/Oracle/instantclient_12_2/sdk/include

            #QMAKE_USE += oci
            QMAKE_LFLAGS += -L"C:/Oracle/instantclient_12_2/sdk/lib/msvc" -loci

            darwin:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ

            OTHER_FILES += oci.json

            PLUGIN_CLASS_NAME = QOCIDriverPlugin
            include(../qsqldriverbase.pri)

            But it still gives me the same errors. Any idea of another thing I might be doing wrong?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Your INCLUDEPATH statement won't completely work since you have one path on a new line.

              Line ending backslashes have their use, you have to use the properly.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • R Offline
                R Offline
                RocioMartinez13
                wrote on last edited by
                #7

                Sorry, I am not very experienced in Qt as you can see...

                So, now I put the INCLUDEPATH like this:

                INCLUDEPATH += C:/Oracle/instantclient_12_2/sdk/lib/msvc
                C:/Oracle/instantclient_12_2/sdk/include

                I suppose the backslashes are for this? Or is it better to put:

                INCLUDEPATH += C:/Oracle/instantclient_12_2/sdk/lib/msvc
                INCLUDEPATH += C:/Oracle/instantclient_12_2/sdk/include

                Do you think I am missing something linking, that's why it gives undefined references?

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  RocioMartinez13
                  wrote on last edited by
                  #8

                  Hello again,

                  I have been modifying quite a lot the environment. I first used another version of Qt, then I used different versions of Instant Client SDK, I used MSVC first but then swap to MinGW... And none of these actions have changed the output of the nmake command.

                  Nevertheless, I found that at some point, some directories in C:/ were created:

                  C:\lib\cmake\Qt5Sql\Qt5Sql_QOCIDriverPlugin.cmake
                  C:\mkspecs\modules-inst
                  C:\mkspecs\modules
                  C:\plugins\sqldrivers containing qsqloci.lib qsqloci.pdb and some others...

                  But there is no .dll created.

                  I have also been following some other threads in this forum such as https://forum.qt.io/topic/78347/windows-10-oracle-driver-compile-problem/7 where is seems to work fine. But for me it is not.

                  If you have any other question that might help me solve this I would appreciate it.

                  Thank you.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    How did you manage to put the build result in your hard drive root folder ?

                    Once you have your stuff built you need to call nmake install.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      RocioMartinez13
                      wrote on last edited by
                      #10

                      Hello.

                      Thank you for replying.

                      I didn't do anything to put the results there. Actually, I don't think they are correct. I don't have any install so it gives me errors when I write nmake install.

                      Any other idea why I am getting this? I do not understand if I am following the right steps why I keep on having undefined references.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        AngelH
                        wrote on last edited by
                        #11

                        Hello,

                        Let me help you a bit.

                        1. Install oracle database client using:
                          Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (32-bit)
                          win32_11gR2_client.zip
                          I installed as Runtime (tools for developing applications)
                          and My Oracle base is C:\app\nehain

                        2. In oci.pro, only comment the line QMAKE_USE += oci:
                          My oci.pro:

                        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
                        
                        PLUGIN_CLASS_NAME = QOCIDriverPlugin
                        include(../qsqldriverbase.pri)
                        
                        1. Open Qt 5.9 for Desktop (MinGW 5.3.0 32 bit)
                        2. cd to C:\QtE\Qt5.9.0\5.9\Src\qtbase\src\plugins\sqldrivers\oci (Maybe your Qt Dir is different)
                        3. qmake "INCLUDEPATH+=C:\app\nehain\product\11.2.0\client_1\oci\include" "LIBS+=-LC:\app\nehain\product\11.2.0\client_1\oci\lib\msvc -loci" oci.pro
                        4. mingw32-make

                        Thats all. Maybe u will need to run mingw32-make clean before qmake.

                        Good luck

                        Angel H.

                        1 Reply Last reply
                        2
                        • R Offline
                          R Offline
                          RocioMartinez13
                          wrote on last edited by
                          #12

                          Hello Angel!

                          Thank you so much for your help!! I just solved it :)

                          I did exactly what you specified and then I ran mingw32-make install and I got the .dll in the C:\Qt\5.9.1\mingw53_32\plugins\sqldrivers folder.

                          Thank you again! :)

                          Rocio

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved