Qt 5.x.编译IBASE plagin Ubuntu 16.10

时间:2017-04-27 08:33:15

标签: qt ubuntu firebird

我有一个问题,你需要在ubuntu的qt5中组装ibase插件。经过我的一系列操作后,我认为你需要挂载文件夹include / firebird但找不到她。

sudo ln -s /usr/lib/i386-linux-gnu/libfbclient.so.2.5.6 /usr/lib/libfbclient.so
sudo ln -s /usr/lib/i386-linux-gnu/libfbclient.so.2.5.6 /usr/lib/libgds.so
sudo ln -s /usr/lib/libfbclient.so /usr/lib/libgds.so.0
sudo ln /usr/lib/libfbclient.so /usr/lib/lgds.so
sudo ln /usr/lib/libfbclient.so /usr/lib/libgds.so

已安装:

dpkg --get-selections | grep firebird
firebird-dev                    install
firebird2.5-classic             deinstall
firebird2.5-common              install
firebird2.5-common-doc              install
firebird2.5-server-common           install
firebird2.5-super               install
libreoffice-sdbc-firebird           install

gbak -z
gbak:gbak version LI-V2.5.6.27020 Firebird 2.5

dpkg -L firebird2.5-super
/.
/etc
/etc/init.d
/etc/init.d/firebird2.5-super
/usr
/usr/bin
/usr/bin/fbstat
/usr/bin/fbsvcmgr
/usr/bin/fbtracemgr
/usr/bin/gbak
/usr/bin/gdef
/usr/bin/gfix
/usr/bin/gpre
/usr/bin/gsec
/usr/bin/isql-fb
/usr/bin/nbackup
/usr/bin/qli
/usr/lib
/usr/lib/firebird
/usr/lib/firebird/2.5
/usr/lib/firebird/2.5/UDF
/usr/lib/firebird/2.5/UDF/fbudf.so
/usr/lib/firebird/2.5/UDF/ib_udf.so
/usr/sbin
/usr/sbin/fb_lock_print
/usr/sbin/fbserver
/usr/share
/usr/share/doc
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/firebird2.5-super
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/fbserver.1.gz
/usr/share/doc/firebird2.5-super

大厦:

sudo cp /usr/lib/x86_64-linux-gnu/firebird/2.5/firebird.msg /opt/firebird/firebird.msg

sudo nano /etc/profile
export FIREBIRD="/opt/firebird"

qmake "INCLUDEPATH+=/usr/bin/" "INCLUDEPATH+=/usr/lib/x86_64-linux-gnu/" "LIBS+=-L/usr/lib/x86_64-linux-gnu/libfbclient.so" "LIBS+=-L/usr/lib/lgds.so" "LIBS+=-L/usr/lib/x86_64-linux-gnu/libdl.so" "LIBS+=-L/usr/lib/libgds.so" "INCLUDEPATH+=/usr/lib/x86_64-linux-gnu/firebird/2.5/" "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib64 -lfbclient" ibase.pro


make

log for Qt 5.2.1 - 5.3

log for Qt 5.4-5.5

log for Qt 5.6

log for Qt 5.7

1 个答案:

答案 0 :(得分:1)

它在Ubuntu 16.10和Debian jessie上成功编译。

序言:

    Debian上的
  • 使用su -代替sudo

  • 用于构建所使用的QT源 wiki

  • /etc/apt/source.list - 您必须在此处添加一些源URI deb-src ...

安装软件包:

sudo apt-get build-dep qt5-default
sudo apt-get install libxcb-xinerama0-dev
sudo apt-get install firebird-dev

源代码树是从git repository克隆的:

cd /usr/src # or any directory you want with w+x 
git clone git://code.qt.io/qt/qt5.git

cd qt5;
git checkout 5.7

perl init-repository

./configure -developer-build -opensource -nomake examples -nomake tests

配置在上面的步骤中没有找到构建InterBase插件的任何内容:

  SQL drivers:
    DB2 .................. no
    InterBase ............ no
    MySQL ................ yes (plugin)
    OCI .................. no
    ODBC ................. yes (plugin)
    PostgreSQL ........... yes (plugin)
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. yes (plugin)

make -j4

# make install # it isn't needed because developers-build 

对于构建firebird插件,使用了this doc

export QTDIR=/usr/src/qt5
export PATH=$QTDIR/qtbase/bin:$PATH

cd $QTDIR/qtbase/src/plugins/sqldrivers/ibase

# to avoid linker error: /usr/bin/ld.gold: error: cannot find -lgds
sudo ln -s /usr/lib/x86_64-linux-gnu/libfbclient.so /usr/lib/libgds.so

qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/x86_64-linux-gnu -lfbclient" ibase.pro
make

我在Ubuntu上遇到以下错误bug-report

  

/ usr / include / c ++ / 6 / cstdlib:75:25:致命错误:stdlib.h:没有这样的文件   或目录        #include_next                                ^

应按以下方式修改生成的Makefile:

INCPATH       = -I. -isystem /usr/include
--> new
INCPATH       = -I. -I/usr/include

后记,重新执行make

rm -f libqsqlibase.so
g++ -Wl,--no-undefined -fuse-ld=gold -Wl,--enable-new-dtags -Wl,-rpath,/usr/src/qt5/qtbase/lib -shared -o libqsqlibase.so .obj/main.o .obj/qsql_ibase.o .obj/moc_qsql_ibase_p.o  -L/usr/lib/x86_64-linux-gnu -lfbclient -lgds -L/usr/src/qt5/qtbase/lib -lQt5Sql -lQt5Core -lpthread
mv -f libqsqlibase.so ../../../../plugins/sqldrivers/

-rwxr-xr-x 1 db src 1241008 May  1 23:55 ../../../../plugins/sqldrivers/libqsqlibase.so

这就是全部。最简单的测试程序显示ibase插件现已上市:

#include <QCoreApplication>
#include <QtSql>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    qDebug() << "drivers available:" << QSqlDatabase::drivers();
    QCoreApplication::exit(0);
}
  

可用的驱动程序:(&#34; QIBASE&#34;,&#34; QSQLITE&#34;,&#34; QMYSQL&#34;,&#34; QMYSQL3&#34;,&#34; QODBC&#34 ;,&#34; QODBC3&#34;,&#34; QPSQL&#34;,&#34; QPSQL7&#34;,&#34; QTDS&#34;,&#34; QTDS7&#34;)

我希望这会对你有所帮助。