Solved Problem building OCI plugin for Qt 5.9.1
-
Hello!
Thank you!
My .pro file is:
TARGET = qsqloci
HEADERS += $$PWD/qsql_oci_p.h
SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cppINCLUDEPATH += 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!
-
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.
-
I modified that, now my .pro looks like:
TARGET = qsqloci
HEADERS += $$PWD/qsql_oci_p.h
SOURCES += $$PWD/qsql_oci.cpp $$PWD/main.cppINCLUDEPATH += 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" -locidarwin: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?
-
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.
-
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/includeI 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/includeDo you think I am missing something linking, that's why it gives undefined references?
-
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.
-
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
. -
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.
-
Hello,
Let me help you a bit.
-
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 -
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)
- Open Qt 5.9 for Desktop (MinGW 5.3.0 32 bit)
- cd to C:\QtE\Qt5.9.0\5.9\Src\qtbase\src\plugins\sqldrivers\oci (Maybe your Qt Dir is different)
- 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
- mingw32-make
Thats all. Maybe u will need to run mingw32-make clean before qmake.
Good luck
Angel H.
-
-
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