How to get rid of OCI.dll dependency when compiling static
My application accesses an Oracle database through the Qt QSqlDatabase class.
I am compiling Qt as static for release build, but I cannot get rid of OCI.dll dependency. I am trying to link with oci.lib (as available in Oracle Instant Client with SDK).
Here's my config line:
configure -qt-libjpeg -qt-zlib -qt-libpng -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -static -release -opensource -plugin-sql-oci -plugin-sql-sqlite -platform win32-msvc2005
I link to oci.h and oci.lib in the SDK folder using:
set INCLUDE=C:\oracle\instantclient\sdk\include;%INCLUDE%
set LIB=C:\oracle\instantclient\sdk\lib\msvc;%LIB%
Then, once Qt is compiled, I use the following lines in the * .pro file:
QT += sql CONFIG += static LIBS += C:\oracle\instantclient\sdk\lib\msvc\oci.lib QTPLUGIN += qsqloci
Then, in my main.cpp, I add the following commands to statically compile the OCI plugin in the application:
#include <QtPlugin>
Q_IMPORT_PLUGIN(qsqloci)
After compiling the project, I test it on my workstation and it works (since I have Oracle Instant Client installed). When I try to execute another workstation, I always get the message:
This application failed to start because OCI.dll was not found. Reinstalling this application can fix this problem.
I don't understand why I still need OCI.dll, as my statically linked application must reference oci.lib.
Are there any Qt people here that might have a solution for me?
Thank you very much!
STL
a source to share
The .lib file you linked is not what you think. This is an import library for a DLL, it needs a linker so that it knows what functions are implemented by oci.dll. I don't see the static version of the library available from Oracle, but didn't look too heavy. This is fairly typical of dbase interfaces.
You will need to follow the instructions for deploying oci.dll, "OCI Instant Client Installation Process" in this document . Changing PATH, joy.
a source to share