Solved Windows 10 Oracle driver compile problem
-
Hi.
I'm working on an application for my theses using qt and oracle database and I'm having trouble compiling the oci driver if anyone can help it would be greatly appreciated( I was also using How to build Oracle driver - Windows with MinGW-ERROR as a guide).
The are the following things I've installed on a Windows 10 x64:-
oracle database 11g release 2
-
qt (qt 5.8 and 5.9)
-
vs 2013.
I've modified the oci.pro file according to How to run project OCI (changed QMAKE_USE += oci to QMAKE_LFLAGS += oci.lib).
Everything works without any problems until I have to run the nmake command or mingw32-make command.
The is what I typed in the console (I would like to mention i ran Qt 5.8 for Desktop (MSVC 2013 32 bit) for msvc and ...(MinGW 5.3.0 32 bit) for mingw):C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC (vcvarsall.bat - needed for msvc to recognize nmake) set INCLUDE=%INCLUDE%;C:\oracle\product\11.2.0\client_1\oci\include set LIB=%LIB%;C:\oracle\product\11.2.0\client_1\oci\lib\msvc cd D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci qmake oci.pro nmake or mingw32-make
This is everything i typed in the console (trying to compile the driver with mingw):
Setting up environment for Qt usage... D:\Programs\Installed\Qt\5.8\mingw53_32>set INCLUDE=%INCLUDE%;C:\oracle\product\11.2.0\client_1\oci\include D:\Programs\Installed\Qt\5.8\mingw53_32>set LIB=%LIB%;C:\oracle\product\11.2.0\client_1\oci\lib\msvc D:\Programs\Installed\Qt\5.8\mingw53_32>cd D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci>qmake oci.pro D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci>mingw32-make mingw32-make -f Makefile.Release all mingw32-make[1]: Entering directory 'D:/Programs/Installed/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/oci' g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++1z -fno-exceptions -frtti -Wall -Wextra -Wvla -Wdate-time -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -ID:\Programs\Installed\Qt\5.8\mingw53_32\include\QtSql\5.8.0 -ID:\Programs\Installed\Qt\5.8\mingw53_32\include\QtSql\5.8.0\QtSql -ID:\Programs\Installed\Qt\5.8\mingw53_32\include\QtCore\5.8.0 -ID:\Programs\Installed\Qt\5.8\mingw53_32\include\QtCore\5.8.0\QtCore -ID:\Programs\Installed\Qt\5.8\mingw53_32\include -ID:\Programs\Installed\Qt\5.8\mingw53_32\include\QtSql -ID:\Programs\Installed\Qt\5.8\mingw53_32\include\QtCore -I.moc\release -IC:\utils\my_sql\my_sql\include -IC:\utils\postgresql\pgsql\include -IC:\openssl\include -I..\..\..\..\mkspecs\win32-g++ -o .obj\release\qsql_oci.o qsql_oci.cpp qsql_oci.cpp:65:17: fatal error: oci.h: No such file or directory compilation terminated. Makefile.Release:350: recipe for target '.obj/release/qsql_oci.o' failed mingw32-make[1]: *** [.obj/release/qsql_oci.o] Error 1 mingw32-make[1]: Leaving directory 'D:/Programs/Installed/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/oci' Makefile:38: recipe for target 'release-all' failed mingw32-make: *** [release-all] Error 2 D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci>
If anyone can help me with this it would be greatly appreciated and thank you in advance.
-
-
I've solved the problem (thank you to everyone who replied it helped a lot).
This is everything i did:- installed oracle instant client 11g
- installed qt (5.8)
- removed vs 2013 if you installed it (the driver can't be build with 2013, same thing applies to mingw under windows)
- installed vs 2015
- installed windows sdk (just the debugger).
After this i modified the oci.pro (changed QMAKE_USE += oci to QMAKE_LFLAGS += oci.lib) - the location of the file is (in my case) D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci.
Then i run Qt 5.8 32-bit for Desktop (MSVC 2015) and i run in it vcvarsall.bat (the location of the file is where you installed vs in my case C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC).set INCLUDE=%INCLUDE%;C:\oracle\product\11.2.0\client_1\oci\include //location of oracle include file oci.h set LIB=%LIB%;C:\oracle\product\11.2.0\client_1\oci\lib\msvc // location of lib files cd D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci // location of my oci.pro file qmake oci.pro nmake
After everything compiled you should find a plugins folder in qt version/src/qtbase (my case - D:\Programs\Installed\Qt\5.8\Src\qtbase). Copy the dlls and the debugger where you compiler is located(the one you used to compile the driver) and you are done.
Happy programming.
-
Hi and welcome to devnet,
You can't mix and match compilers like that. Which version of Qt are you building for ? What compiler was used to build your OCI libraries ?
-
@SGaist
Thank you for the rely(I'm a beginner at this, please bear with me).I want to use msvc ( tried mingw but after some research i found that qt doesn't support it under windows).
The version i'm building for is 5.8 (from what i noticed 5.9 is 64 bit only for vs 2013).
For building i used Qt 5.8 32-bit for Desktop (MSVC 2013) with vcvarsall.bat.
If i launch it from the vs console it doesn't recognize qmake.This is everything i did in the console.
Setting up environment for Qt usage... Remember to call vcvarsall.bat to complete environment setup! D:\Programs\Installed\Qt\5.8\msvc2013>c: C:\Windows\System32>cd C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>vcvarsall.bat C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>d: D:\Programs\Installed\Qt\5.8\msvc2013>set INCLUDE=%INCLUDE%;C:\oracle\product\11.2.0\client_1\oci\include D:\Programs\Installed\Qt\5.8\msvc2013>set LIB=%LIB%;C:\oracle\product\11.2.0\client_1\oci\lib\msvc D:\Programs\Installed\Qt\5.8\msvc2013>cd D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci>qmake oci.pro D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci>nmake Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe" -f Makefile.Release all Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. D:\Programs\Installed\Qt\5.8\msvc2013\bin\moc.exe -DUNICODE -DWIN32 -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DNDEBUG -D_WINDLL --compiler-flavor=msvc --include .moc/release/moc_predefs.h -ID:/Programs/Installed/Qt/5.8/Src/qtbase/mkspecs/win32-msvc2013 -ID:/Programs/Installed/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/oci -ID:/Programs/Installed/Qt/5.8/msvc2013/include/QtSql/5.8.0 -ID:/Programs/Installed/Qt/5.8/msvc2013/include/QtSql/5.8.0/QtSql -ID:/Programs/Installed/Qt/5.8/msvc2013/include/QtCore/5.8.0 -ID:/Programs/Installed/Qt/5.8/msvc2013/include/QtCore/5.8.0/QtCore -ID:/Programs/Installed/Qt/5.8/msvc2013/include -ID:/Programs/Installed/Qt/5.8/msvc2013/include/QtSql -ID:/Programs/Installed/Qt/5.8/msvc2013/include/QtCore -I%INCLUDE% -IC:\oracle\product\11.2.0\client_1\oci\include main.cpp -o .moc\release\main.moc moc: Too many input files specified: 'Files' '(x86)\Microsoft' 'Visual' 'Studio' '12.0\VC\INCLUDE;C:\Program' 'Files' '(x86)\Microsoft' 'Visual' 'Studio' '12.0\VC\ATLMFC\INCLUDE;C:\Program' 'Files' '(x86)\Windows' 'Kits\8.1\include\shared;C:\Program' 'Files' '(x86)\Windows' 'Kits\8.1\include\um;C:\Program' 'Files' '(x86)\Windows' 'Kits\8.1\include\winrt;;C:\oracle\product\11.2.0\client_1\oci\include' 'main.cpp' Usage: D:\Programs\Installed\Qt\5.8\msvc2013\bin\moc.exe [options] [header-file] [@option-file] Qt Meta Object Compiler version 67 (Qt 5.8.0) Options: -?, -h, --help Displays this help. -v, --version Displays version information. -o <file> Write output to file rather than stdout. -I <dir> Add dir to the include path for header files. -F <framework> Add Mac framework to the include path for header files. -E Preprocess only; do not generate meta object code. -D <macro[=def]> Define macro, with optional definition. -U <macro> Undefine macro. -M <key=value> Add key/value pair to plugin meta data --compiler-flavor <flavor> Set the compiler flavor: either "msvc" or "unix". -i Do not generate an #include statement. -p <path> Path prefix for included file. -f <file> Force #include <file> (overwrite default). -b <file> Prepend #include <file> (preserve default include). --include <file> Parse <file> as an #include before the main source(s). -n <which> Do not display notes (-nn) or warnings (-nw). Compatibility option. --no-notes Do not display notes. --no-warnings Do not display warnings (implies --no-notes). --ignore-option-clashes Ignore all options that conflict with compilers, like -pthread conflicting with moc's -p option. Arguments: [header-file] Header file to read from, otherwise stdin. [@option-file] Read additional options from option-file. NMAKE : fatal error U1077: 'D:\Programs\Installed\Qt\5.8\msvc2013\bin\moc.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. D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci>
I don't understand why the help command gets "activated", is moc or nmake confused or something?
-
The Qt project has provided pre-built packages for MinGW for years.
Then again, the same question: what compiler was used to build the Oracle libraries ?
-
None(i mean i didn't build them). I installed them(i got the win32_11gR2_client.zip). The only time i tried to compile anything was when i tried to do it for the oci driver and i use msvc from Qt 5.8 32-bit for Desktop (MSVC 2013) console with vcvarsall.bat to recognize nmake command (the vs console doesn't recognize qmake and i don't know how to make it to do it).
-
@darius93 "the vs console doesn't recognize qmake" - you can just use absolute path to qmake.exe
What @SGaist is telling you is: you have to use exact same compiler for both the library and your app. With same I mean even same version. That means: if the Oracle library was build with, let's say, MSVC2015 then you cannot use it with MSVC2013. You need to find out which compiler was used to build Oracle library. -
I've solved the problem (thank you to everyone who replied it helped a lot).
This is everything i did:- installed oracle instant client 11g
- installed qt (5.8)
- removed vs 2013 if you installed it (the driver can't be build with 2013, same thing applies to mingw under windows)
- installed vs 2015
- installed windows sdk (just the debugger).
After this i modified the oci.pro (changed QMAKE_USE += oci to QMAKE_LFLAGS += oci.lib) - the location of the file is (in my case) D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci.
Then i run Qt 5.8 32-bit for Desktop (MSVC 2015) and i run in it vcvarsall.bat (the location of the file is where you installed vs in my case C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC).set INCLUDE=%INCLUDE%;C:\oracle\product\11.2.0\client_1\oci\include //location of oracle include file oci.h set LIB=%LIB%;C:\oracle\product\11.2.0\client_1\oci\lib\msvc // location of lib files cd D:\Programs\Installed\Qt\5.8\Src\qtbase\src\plugins\sqldrivers\oci // location of my oci.pro file qmake oci.pro nmake
After everything compiled you should find a plugins folder in qt version/src/qtbase (my case - D:\Programs\Installed\Qt\5.8\Src\qtbase). Copy the dlls and the debugger where you compiler is located(the one you used to compile the driver) and you are done.
Happy programming.