Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: Компиляция OCI-плагина под Win7
Форум на CrossPlatform.RU > Разработка > SQL. Базы данных.
bayah
Из Qt-приложения хочу подключиться к базе Oracle.
Для этго мне нужен OCI драйвер. Но "Из-за несовместимости с GPL лицензией, не все плагины поставляются с Qt Open Source Edition."
Короче плагин нужно скомпилить.

Делаю по этой инструкции:

http://doc.crossplatform.ru/qt/4.3.2/sql-d...l-interface-oci

Нашел какой-то qmake - их почему-то в каталоге qt много разных
Что-то собралось
но nmake у меня нет
nmake это я так понимаю сборщик от MVC?


Короче следующие вопросы:

1. Обязательно ли собирать nmake-ом, если у меня win7, и для чего тогда mingw?
2. Где взять nmake? Ставить MVC?

Все.
Спасибо заранее.
ilyabvt
По ссылке написано:
Цитата
Если вы используете компилятор не от Microsoft, замените nmake на make.
bayah
Делаю так:

set INCLUDE=%INCLUDE%;C:\oracle\product\10.2.0\client_1\oci\includeset LIB=%LIB%;C:\oracle\product\10.2.0\client_1\oci\lib\msvc
cd %QTDIR%\src\plugins\sqldrivers\oci
qmake -o Makefile oci.pro
C:\QtSDK\Symbian\tools\sbs\win32\mingw\bin\make.exe


C:\oracle\product\10.2.0\client_1 - тут у меня стоит клиент Oracle(Programmer)
QTDIR = C:\QtSDK\QtSources\4.8.1


в результате получаю:

ошибка
Цитата
C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\oci>C:\QtSDK\Symbian\tools\sbs\w
in32\mingw\bin\make
C:/QtSDK/Symbian/tools/sbs/win32/mingw/bin/make -f Makefile.Debug
make[1]: Entering directory `C:/QtSDK/QtSources/4.8.1/src/plugins/sqldrivers/oci
'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -
DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H
AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtCore"
-I"c:\QtSDK\Desktop\Qt\4.8.1\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.8.1\m
ingw\include" -I"c:\Orant\client_2\oci\include" -I"." -I"..\..\..\sql\kernel" -I
"..\..\..\sql\drivers\oci" -I"c:\oracle\product\10.2.0\client_1\oci\include" -I"
..\..\..\sql\drivers\oci" -I"c:\QtSDK\Desktop\Qt\4.8.1\mingw\include\ActiveQt" -
I"debug" -I"c:\QtSDK\Desktop\Qt\4.8.1\mingw\mkspecs\default" -o debug\qsql_oci.o
..\..\..\sql\drivers\oci\qsql_oci.cpp
..\..\..\sql\drivers\oci\qsql_oci.cpp:65:17: error: oci.h: No such file or direc
tory

..
\..\..\sql\drivers\oci\qsql_oci.cpp:86: error: 'OCIStmt' was not declared in t
his scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:86: error: template argument 1 is invalid
..\..\..\sql\drivers\oci\qsql_oci.cpp:107: error: 'ub2' does not name a type
..\..\..\sql\drivers\oci\qsql_oci.cpp:110: error: 'sb2' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:110: error: template argument 1 is invalid

..\..\..\sql\drivers\oci\qsql_oci.cpp:110: error: invalid type in declaration be
fore ';' token
..\..\..\sql\drivers\oci\qsql_oci.cpp:111: error: 'ub2' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:111: error: template argument 1 is invalid

..\..\..\sql\drivers\oci\qsql_oci.cpp:111: error: invalid type in declaration be
fore ';' token
..\..\..\sql\drivers\oci\qsql_oci.cpp:116: error: 'OCIError' has not been declar
ed
..\..\..\sql\drivers\oci\qsql_oci.cpp:117: error: 'OCIError' has not been declar
ed
..\..\..\sql\drivers\oci\qsql_oci.cpp:119: error: 'OCIError' has not been declar
ed
..\..\..\sql\drivers\oci\qsql_oci.cpp:120: error: 'OCIError' has not been declar
ed
..\..\..\sql\drivers\oci\qsql_oci.cpp:122: error: 'OCIError' was not declared in
this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:122: error: 'err' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:122: error: expected primary-expression be
fore 'int'
..\..\..\sql\drivers\oci\qsql_oci.cpp:127: error: 'OCIError' has not been declar
ed
..\..\..\sql\drivers\oci\qsql_oci.cpp:128: error: 'OCIError' has not been declar
ed
..\..\..\sql\drivers\oci\qsql_oci.cpp:138: error: ISO C++ forbids declaration of
'OCIRowid' with no type
..\..\..\sql\drivers\oci\qsql_oci.cpp:138: error: expected ';' before '*' token
..\..\..\sql\drivers\oci\qsql_oci.cpp: In constructor 'QOCIRowId::QOCIRowId(OCIE
nv*)':
..\..\..\sql\drivers\oci\qsql_oci.cpp:145: error: class 'QOCIRowId' does not hav
e any field named 'id'
..\..\..\sql\drivers\oci\qsql_oci.cpp:147: error: expected type-specifier before
'dvoid'
..\..\..\sql\drivers\oci\qsql_oci.cpp:147: error: expected '>' before 'dvoid'
..\..\..\sql\drivers\oci\qsql_oci.cpp:147: error: expected '(' before 'dvoid'
..\..\..\sql\drivers\oci\qsql_oci.cpp:147: error: 'dvoid' was not declared in th
is scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:147: error: expected primary-expression be
fore '>' token
..\..\..\sql\drivers\oci\qsql_oci.cpp:147: error: 'id' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:148: error: 'OCI_DTYPE_ROWID' was not decl
ared in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp: In destructor 'QOCIRowId::~QOCIRowId()':
..\..\..\sql\drivers\oci\qsql_oci.cpp:153: error: 'id' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:154: error: 'OCI_DTYPE_ROWID' was not decl
ared in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:154: error: 'OCIDescriptorFree' was not de
clared in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp: At global scope:
..\..\..\sql\drivers\oci\qsql_oci.cpp:172: error: ISO C++ forbids declaration of
'OCIError' with no type
..\..\..\sql\drivers\oci\qsql_oci.cpp:172: error: expected ';' before '*' token
..\..\..\sql\drivers\oci\qsql_oci.cpp:174: error: ISO C++ forbids declaration of
'OCIStmt' with no type
..\..\..\sql\drivers\oci\qsql_oci.cpp:174: error: expected ';' before '*' token
..\..\..\sql\drivers\oci\qsql_oci.cpp:180: error: 'OCIStmt' has not been declare
d
..\..\..\sql\drivers\oci\qsql_oci.cpp:180: error: 'OCIBind' has not been declare
d
..\..\..\sql\drivers\oci\qsql_oci.cpp:180: error: 'OCIError' has not been declar
ed
..\..\..\sql\drivers\oci\qsql_oci.cpp:181: error: 'dvoid' has not been declared
..\..\..\sql\drivers\oci\qsql_oci.cpp:181: error: 'ub2' has not been declared
..\..\..\sql\drivers\oci\qsql_oci.cpp:191: error: 'dvoid' has not been declared
..\..\..\sql\drivers\oci\qsql_oci.cpp:191: error: 'ub4' has not been declared
..\..\..\sql\drivers\oci\qsql_oci.cpp: In member function 'void QOCIResultPrivat
e::setCharset(int*, int) const':
..\..\..\sql\drivers\oci\qsql_oci.cpp:217: error: 'qOraCharset' was not declared
in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:219: error: 'OCI_ATTR_CHARSET_ID' was not
declared in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:220: error: 'err' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:220: error: 'OCIAttrSet' was not declared
in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp: In member function 'void QOCIResultPrivat
e::setStatementAttributes()':
..\..\..\sql\drivers\oci\qsql_oci.cpp:229: error: 'sql' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:235: error: 'OCI_HTYPE_STMT' was not decla
red in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:238: error: 'OCI_ATTR_PREFETCH_ROWS' was n
ot declared in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:239: error: 'err' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:239: error: 'OCIAttrSet' was not declared
in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:246: error: 'OCI_HTYPE_STMT' was not decla
red in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:249: error: 'OCI_ATTR_PREFETCH_MEMORY' was
not declared in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:250: error: 'err' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:250: error: 'OCIAttrSet' was not declared
in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp: At global scope:
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: 'int QOCIResultPrivate::bindVa
lue' is not a static member of 'struct QOCIResultPrivate'
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: 'OCIStmt' was not declared in
this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: 'sql' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: 'OCIBind' was not declared in
this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: 'hbnd' was not declared in thi
s scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: 'OCIError' was not declared in
this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: 'err' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:257: error: expected primary-expression be
fore 'int'
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: expected primary-expression be
fore 'const'
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: 'dvoid' was not declared in th
is scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: 'indPtr' was not declared in t
his scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: 'ub2' was not declared in this
scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: 'tmpSize' was not declared in
this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: expected primary-expression be
fore '&' token
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: 'tmpStorage' was not declared
in this scope
..\..\..\sql\drivers\oci\qsql_oci.cpp:258: error: initializer expression list tr
eated as compound expression
..\..\..\sql\drivers\oci\qsql_oci.cpp:259: error: expected ',' or ';' before '{'
token
..\..\..\sql\drivers\oci\qsql_oci.cpp:113: warning: 'QByteArray qMakeOraDate(con
st QDateTime&)' declared 'static' but never defined
..\..\..\sql\drivers\oci\qsql_oci.cpp:114: warning: 'QDateTime qMakeDate(const c
har*)' declared 'static' but never defined
..\..\..\sql\drivers\oci\qsql_oci.cpp:116: warning: 'QByteArray qMakeOCINumber(c
onst qlonglong&, int*)' declared 'static' but never defined
..\..\..\sql\drivers\oci\qsql_oci.cpp:117: warning: 'QByteArray qMakeOCINumber(c
onst qulonglong&, int*)' declared 'static' but never defined
..\..\..\sql\drivers\oci\qsql_oci.cpp:119: warning: 'qlonglong qMakeLongLong(con
st char*, int*)' declared 'static' but never defined
..\..\..\sql\drivers\oci\qsql_oci.cpp:120: warning: 'qulonglong qMakeULongLong(c
onst char*, int*)' declared 'static' but never defined
..\..\..\sql\drivers\oci\qsql_oci.cpp:127: warning: 'void qOraWarning(const char
*, int*)' declared 'static' but never defined
..\..\..\sql\drivers\oci\qsql_oci.cpp:128: warning: 'QSqlError qMakeError(const
QString&, QSqlError::ErrorType, int*)' declared 'static' but never defined
make[1]: *** [debug/qsql_oci.o] Error 1
make[1]: Leaving directory `C:/QtSDK/QtSources/4.8.1/src/plugins/sqldrivers/oci'

make: *** [debug] Error 2


Этого файла - oci.h - нигде не могу найти.
Что делаю не так?
Алексей1153
первым делом нужно сделать вот так

http://www.google.ru/#hl=ru&newwindow=...231&bih=981
bayah
У меня не оказалось oci.h вообще в той версии Oraclce клиента, что я поставил(Oracle Cleint 10g)

Переделал как написано тут:
http://stackoverflow.com/questions/1254550...ci-driver-in-qt
Поставил Oracle Client 10g Express и прописал соответствующие пути.
Пеперь сборка выглядит так:


set INCLUDE=%INCLUDE%;C:\XEClient\oci\include
set LIB=%LIB%;C:\XEClient\oci\lib\msvc
cd %QTDIR%\src\plugins\sqldrivers\oci
qmake -o Makefile oci.pro
C:\QtSDK\Symbian\tools\sbs\win32\mingw\bin\make.exe



Теперь вот что пишет:

C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\oci>C:\QtSDK\Symbian\tools\sbs\w
in32\mingw\bin\make.exe
C:/QtSDK/Symbian/tools/sbs/win32/mingw/bin/make -f Makefile.Debug
make[1]: Entering directory `C:/QtSDK/QtSources/4.8.1/src/plugins/sqldrivers/oci
'
g++ -mthreads -shared -Wl,--out-implib,debug\libqsqlocid4.a -o debug\qsqlocid4.d
ll debug/main.o debug/qsql_oci.o debug/moc_qsql_oci.o -L"c:\QtSDK\Desktop\Qt\4.
8.1\mingw\lib" debug\qsqlocid_resource_res.o -LC:\XEClient\oci\lib\msvc C:\QtSDK
\QtSources\4.8.1\src\sql\drivers\oci -loci -lQtSqld4 -lQtCored4
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: C:\Q
tSDK\QtSources\4.8.1\src\sql\drivers\oci: No such file: Permission denied

collect2: ld returned 1 exit status
make[1]: *** [debug\qsqlocid4.dll] Error 1
make[1]: Leaving directory `C:/QtSDK/QtSources/4.8.1/src/plugins/sqldrivers/oci'

make: *** [debug] Error 2



Что с этим делать?
Алексей1153
я даже не смотрел, что там выдалось )
http://www.google.ru/#hl=en&newwindow=...268&bih=766

bayah
не ну так-то уж не надо)
я гуглом еще умею немного пользоваться


эту проблему решил уже
вот таким способом, как тут:
http://www.forum.crossplatform.ru/index.php?showtopic=3841
- добавил -L в строку:

LIBS+=-Lc:\oracle9\oci\lib\msvc




Плагин вроде собрался - ошибок не выдал.
Но теперь пробую подключиться к базе:


#include <QtCore/QCoreApplication>
#include <QtSql>

.pro

#-------------------------------------------------
#
# Project created by QtCreator 2013-03-05T09:43:42
#
#-------------------------------------------------

QT       += core

QT       -= gui

TARGET = oracledb1
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp



#---bayah



QT       += sql
LIBS += -L"C:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\oci\release"
LIBS += -L"C:\XEClient\oci\lib"
LIBS += -L"C:\Qt\4.0.0\plugins\sqldrivers"


TARGET = oracledb
CONFIG   += console
CONFIG   += app_bundle
CONFIG += qt console

.cpp

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QSqlDatabase db = QSqlDatabase::addDatabase("QOCI", "mydb");
    return a.exec();
}



Выдает вот что:

QSqlDatabase: QOCI driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

Почему не находится драйвер?
Алексей1153
поройся вот в этом разделе
http://www.forum.crossplatform.ru/index.php?showforum=34

например, вот тут уже встречается описание, как собрать и где расположить нужный плагин. Они все аналогично делаются.
http://www.forum.crossplatform.ru/index.php?showtopic=5267
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Форум IP.Board © 2001-2024 IPS, Inc.