Build sqlite driver with ICU extension
-
Hi.
I need to use the ICU extension with sqlite, but I didn't succeed in compiling it with Qt.
The loadable extension on sqlite works well (I'm on linux)
gcc -fPIC -shared icu.c `pkg-config --libs --cflags icu-uc icu-io` -o libicu.so -I/usr/include/
I try to build a Qt driver with this extension enabled.
What I do:
Git clone qtbase, then checkout to the version I use (v5.9.9, another guy is in charge for the update).
I add to the file src/plugins/sqldrivers/sqlite/sqlite.pro just after the TARGET line:DEFINES += SQLITE_ENABLE_ICU QMAKE_CXXFLAGS += -licuio -licui18n -licuuc -licudata
(I tried with QMAKE_LDFLAGS, same result).
then./configure -qt-sqlite cd src/plugins/sqldrivers/sqlite qmake make
And I receive a lot of undefined reference to u_foldCase_66, undefined reference to ucol_strcoll_66, etc.
(I don't know where the _66 come from).What did I do wrong (maybe I want something impossible or not in the right way to do)?
Thank you.
-
Hi and welcome to devnet,
@marcv said in Build sqlite driver with ICU extension:
u_foldCase_66
Any chances you have ICU 66 in your system ?
-
@marcv said in Build sqlite driver with ICU extension:
QMAKE_CXXFLAGS += -licuio -licui18n -licuuc -licudata
Two comments:
- You should use LIBS instead of QMAKE_CXXFLAGS (see https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html
- You should also add -LPATH_TO_FOLDER_CONTAINING_LIB
-
@SGaist said in Build sqlite driver with ICU extension:
Hi and welcome to devnet,
@marcv said in Build sqlite driver with ICU extension:
u_foldCase_66
Any chances you have ICU 66 in your system ?
Yes, I have libicu66 installed.
What I don't understand is in the code where the error occurs, there is u_foldCase(), but no u_foldCase_66 (and even google does not seems to know it, only on a project "native_bridge_support" for Android).@jsulm said in Build sqlite driver with ICU extension:
@marcv said in Build sqlite driver with ICU extension:
QMAKE_CXXFLAGS += -licuio -licui18n -licuuc -licudata
Two comments:
- You should use LIBS instead of QMAKE_CXXFLAGS (see https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html
- You should also add -LPATH_TO_FOLDER_CONTAINING_LIB
Thank you for your tips.
Sadly I have the same errors. -
TARGET = qsqlite DEFINES += SQLITE_ENABLE_ICU LIBS += -licuio -licui18n -licuuc -licudata -L/home/marc/labo/icu HEADERS += $$PWD/qsql_sqlite_p.h SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp include($$OUT_PWD/../qtsqldrivers-config.pri) QT_FOR_CONFIG += sqldrivers-private qtConfig(system-sqlite) { QMAKE_USE += sqlite } else { include($$PWD/../../../3rdparty/sqlite.pri) } OTHER_FILES += sqlite.json PLUGIN_CLASS_NAME = QSQLiteDriverPlugin include(../qsqldriverbase.pri)
/home/marc/labo/icu is where the file libicu.so is located.
Yes I make a complete rebuild (to be sure I removed the repository and recloned it).
The complete error file is here: https://pastebin.com/y8a9TUUi
-
@marcv said in Build sqlite driver with ICU extension:
-L/home/marc/labo/icu
Try to put this as first entry in LIBS.
"/home/marc/labo/icu is where the file libicu.so is located." - what about all the other icu* libs?
-
@jsulm said in Build sqlite driver with ICU extension:
@marcv said in Build sqlite driver with ICU extension:
-L/home/marc/labo/icu
Try to put this as first entry in LIBS.
"/home/marc/labo/icu is where the file libicu.so is located." - what about all the other icu* libs?
Same.
The icu headers are in "/usr/include/unicode" and the libs in "/usr/lib/x86_64-linux-gnu", but that's the purpose of -licuio -licui18n -licuuc -licudata.
I thought...BUT IT WORKS !!!!
The final .pro file is:
TARGET = qsqlite DEFINES += SQLITE_ENABLE_ICU LIBS += -L/usr/lib/x86_64-linux-gnu -licuio -licui18n -licuuc -licudata HEADERS += $$PWD/qsql_sqlite_p.h SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp include($$OUT_PWD/../qtsqldrivers-config.pri) QT_FOR_CONFIG += sqldrivers-private qtConfig(system-sqlite) { QMAKE_USE += sqlite } else { include($$PWD/../../../3rdparty/sqlite.pri) } OTHER_FILES += sqlite.json PLUGIN_CLASS_NAME = QSQLiteDriverPlugin include(../qsqldriverbase.pri
I have my qtbase/plugins/sqldrivers/libqsqlite.so file. Now I can pass to the coding part.
Thank you very much for your help.