顯示具有 compile qt source code 標籤的文章。 顯示所有文章
顯示具有 compile qt source code 標籤的文章。 顯示所有文章

2016年1月17日 星期日

build qt 4.8.5 database drvier postgresql plugin - windows xp

env:
windows xp
postgresql 9.3
qt 4.8.5
mingw 4.8.0

我將 postgresql 9.3 安裝到 C:\pgsql9.3

qt 文件一樣有提到如何做:
qt-everywhere-opensource-src-4.8.5/doc/html/sql-driver.html#qpsql

cd $QTDIR/src/plugins/sqldrivers/psql
qmake "INCLUDEPATH+=/usr/include/pgsql" "LIBS+=-L/usr/lib -lpq" psql.pro
make

不過和 build mysql driver 類似, 我沒用這方法, 修改了以下檔案。


修改 src/plugins/sqldrivers/psql/psql.pro
cat src/plugins/sqldrivers/psql/psql.pro
TARGET = qsqlpsql

SOURCES = main.cpp
include(../../../sql/drivers/psql/qsql_psql.pri)

INCLUDEPATH+="C:\pgsql9.3\include"
LIBS+="C:\pgsql9.3\lib\libpq.dll"

include(../qsqldriverbase.pri)

不知道是不是因為我使用 static link 的關係, 我還必須修改 src/sql/drivers/psql/qsql_psql.pri
cat src/sql/drivers/psql/qsql_psql.pri
HEADERS += $$PWD/qsql_psql.h
SOURCES += $$PWD/qsql_psql.cpp
LIBS += "c:\pgsql9.3\lib\libpq.lib"
INCLUDEPATH += "c:\pgsql9.3\include"
unix|win32-g++* {
  LIBS += $$QT_LFLAGS_PSQL
  !contains(LIBS, .*pq.*):LIBS += -lpq
  QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
} else {
  !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32
}

D:\qt-everywhere-opensource-src-4.8.5>configure -static -release -no-exceptions -no-qt3support -qt-sql-psql -qt-sql-odbc -qt-sql-sqlite -no-opengl

不過編譯出來的 qt 程式需相依 pgsql 9.3 很多 dll, 我直接複製到 C:\pgsql9.3\bin, 省下那些尋找 dll 的麻煩問題。


產生後的執行檔需要不少 pgsql dll, 我直接把 qt 執行檔 copy 到 pgsql 目錄下 (C:\pgsql9.3\bin), 省下找尋 dll 的麻煩事情。

qt/windows static link, 請參考:
in windows using static link for QT application

2014年9月14日 星期日

qt 5.4 alpha for android

1st edition: 20131002
2nd edition: 20140914

qt 5.4 alpha

env:
debian 32 bit
ndk: android-ndk-r10
sdk: adt-bundle-linux-x86-20140702

為了 camera 的問題, 終於等到你。

../qt-everywhere-opensource-src-5.4.0-alpha/configure  -xplatform android-g++ -nomake tests -nomake examples -android-ndk /home/descent/and-dev/android-ndk-r10 -android-sdk /home/descent/and-dev/adt-bundle-linux-x86-20140702/sdk -android-ndk-host linux-x86 -android-toolchain-version 4.8 -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples

不過在我辛苦 build 好 5.4 之後, camera app 還是無法正常在我的 kolin 7 吋平版上使用。

白作工了。

qt 5.2 alpha

env:
ubuntu 12.04 64bit
qtcreator : 2.8.0
g++ version: (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
ndk: android-ndk-r9
sdk: adt-bundle-linux-x86-20130522
android api 版本安裝了 10, 11, 16, 17, 18 有些沒裝會出錯, 這是我一一補齊的結果。

這次畫面總算對了。



qt 5.2 alpha 沒有 binary 可用, build from source.

get qt 5.2 alpha source code:
http://download.qt-project.org/development_releases/qt/5.2/5.2.0-alpha/single/

ref:
build android qt version from source code:
http://qt-project.org/wiki/Qt5ForAndroidBuilding

我自己用的 configure 參數:
export ANDROID_BUILD_TOOLS_REVISION=18.1.0
所以 build-tools path 是
adt-bundle-linux-x86-20130522/sdk/build-tools/18.1.0

../qt-everywhere-opensource-src-5.2.0-alpha/configure -developer-build -xplatform android-g++ -nomake tests -nomake examples -android-ndk /home/descent/android-dev/android-ndk-r8e -android-sdk /home/descent/android-dev/adt-bundle-linux-x86-20130522/sdk -android-ndk-host linux-x86 -android-toolchain-version 4.7 -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples 

../qt-everywhere-opensource-src-5.2.0-alpha/configure  -xplatform android-g++ -nomake tests -nomake examples -android-ndk /home/descent/android-dev/android-ndk-r9 -android-sdk /home/descent/android-dev/adt-bundle-linux-x86-20130522/sdk -android-ndk-host linux-x86_64 -android-toolchain-version 4.8 -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples 
-developer-build 會把 warnning 當成錯誤, 所以我拿掉了。
記得
make install
這步驟一定要做, 要不然設定 qtcreator 會怪怪的。

qt 5.2 安裝後的目錄結構:
ls /usr/local/Qt-5.2.0/
bin  doc  imports  include  jar  lib  mkspecs  plugins  qml  src
設定 qtcreator
tool/options/Build & Run/Qt Versions add qt5.2 qmake
tool/options/android 設定 sdk, ndk

使用 qtcreator 很容易有問題, 我搭配 adb 指令來把 a3.apk (自己寫的測試程式) 傳到模擬器上。

2014年3月31日 星期一

build database drvier postgresql plugin in windows - qt4

env:
windows xp
postgresql 9.3
qt 4.8.5

我將 postgresql 9.3 安裝到 C:\pgsql9.3

修改 src/plugins/sqldrivers/psql/psql.pro
cat src/plugins/sqldrivers/psql/psql.pro
TARGET = qsqlpsql

SOURCES = main.cpp
include(../../../sql/drivers/psql/qsql_psql.pri)

INCLUDEPATH+="C:\pgsql9.3\include"
LIBS+="C:\pgsql9.3\lib\libpq.dll"

include(../qsqldriverbase.pri)

修改 src/sql/drivers/psql/qsql_psql.pri
cat src/sql/drivers/psql/qsql_psql.pri
HEADERS += $$PWD/qsql_psql.h
SOURCES += $$PWD/qsql_psql.cpp
LIBS += "c:\pgsql9.3\lib\libpq.lib"
INCLUDEPATH += "c:\pgsql9.3\include"
unix|win32-g++* {
    LIBS += $$QT_LFLAGS_PSQL
    !contains(LIBS, .*pq.*):LIBS += -lpq
    QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
} else {
    !contains(LIBS, .*pq.*):LIBS += -llibpq -lws2_32 -ladvapi32
}

D:\qt-everywhere-opensource-src-4.8.5>configure -static -release -no-exceptions -no-qt3support -qt-sql-psql -qt-sql-odbc -qt-sql-sqlite -no-opengl

不過編譯出來的 qt 程式需相依 pgsql 9.3 很多 dll, 我直接複製到 C:\pgsql9.3\bin, 省下那些尋找 dll 的麻煩問題。

另外我還使用 static link, 請參考:
in windows using static link for QT application

2013年8月14日 星期三

build database drvier mysql plugin in windows - qt4

env: windows 7

build mysql plugin in windows environment.
很麻煩, 好像只能從 source code 編譯出來, windows 似乎沒有 binary 的版本 。讓我們從 source code 開始吧!

compiler: mingw 4.4.0
我把 mysql 安裝在
C:/MySQL/MySQL Server 5.1/

和文件上有點不同, 我直接修改 mysql.pro, 加入紅色部份。
edit D:\qt-everywhere-opensource-src-4.7.3\src\plugins\sqldrivers\mysql\mysql.pro

TARGET = qsqlmysql
SOURCES = main.cpp
INCLUDEPATH+="C:/MySQL/MySQL Server 5.1/include"
LIBS+="C:/MySQL/MySQL Server 5.1/lib/opt/libmysql.lib"
include(../../../sql/drivers/mysql/qsql_mysql.pri)
include(../qsqldriverbase.pri)


cd D:\qt-everywhere-opensource-src-4.7.3\src\plugins\sqldrivers\mysql\mysql.pro
D:\qt-everywhere-opensource-src-4.7.3\bin\qmake mysql.pro
在重新 make 即可。

D:\qt-everywhere-opensource-src-4.7.3\plugins\sqldrivers
libqsqlmysql4.a
libqsqlmysqld4.a
qsqlmysql4.dllqsqlmysqld4.dll


還沒完, 到這裡的時候, 我做了測試, 發現雖然編譯出 qsqlmysqld4.dll 這些 dll, 但是 qt 在偵測所有的 sql plging drivers 時, 仍然找不到 qmysql driver, 也就是無法 load qsqlmysqld* 這些 dll。

copy C:\MySQL\MySQL Server 5.1\bin\libmySQL.dll (開頭的參考文件似乎有點錯誤) 到 D:\qt-everywhere-opensource-src-4.7.3\bin 下, 這樣使用

QStringList drivers = QSqlDatabase::drivers();

就可看到 QMYSQL, QMYSQL3 這個 mysql driver 了。

接下來就可以開始測試 sql command。

想要 static link 的版本嗎?請參考:
in windows using static link for QT application

2013年8月8日 星期四

compile qt source code (2) - qt embedded version for x86/linux

20121003 edit

env: ubuntu 10.04 64bit

x86/linux qt embedded 4.8.3 version
我要使用 Shadow building 這樣會比較方便。
顯示 embedded 的編譯選項
../qt-everywhere-opensource-src-4.8.3/configure -embedded --help|less

編譯選項
ref: http://www.qtforum.org/article/36628/compiling-qt-on-i386-to-x86-64.html

這是我用的編譯選項
descent@linux:qt-4.8.3-embedded-x86$
../qt-everywhere-opensource-src-4.8.3/configure -embedded x86 -no-qt3support -xplatform qws/linux-x86_64-g++  -no-largefile -exceptions -no-qt3support         -openssl -no-cups -depths 8,16,18,32 -qt-kbd-tty -qt-kbd-qvfb -qt-kbd-linuxinput -qt-mouse-linuxinput -qt-mouse-qvfb -qt-mouse-pc -opensource -plugin-gfx-directfb  -plugin-gfx-linuxfb -plugin-gfx-qvfb -plugin-gfx-transformed -plugin-gfx-vnc
make
sudo make install

會安裝到 /usr/local/Trolltech/QtEmbedded-4.8.3/

測試:
我使用 qvfb 來做測試, 先執行 qvfb (從你的 linux 安裝套件可以得到或是自己編譯 qt for X 的版本, 從 /qt-4.8.3-x86/tools/qvfb/ 編出來)

/usr/local/Trolltech/QtEmbedded-4.8.3/examples/widgets/analogclock/analogclock  -qws
descent@weiya-linux:qt-4.8.3-embedded-x86$ examples/widgets/sliders/sliders -qws -display QVFb:0



don't compile examples and demo:
http://www.qtcentre.org/threads/25441-how-can-i-don-t-compile-qt-demos-and-examples

http://stackoverflow.com/questions/11832120/qt-embedded-exchanged-colors-bits-red-and-blue

QWS_DISPLAY=LinuxFb:/dev/fb0:depth=16 ./app -qws

20130328 edit

env: debian 32bit
之前的努力結合起來:

參數編譯:
../qt-everywhere-opensource-src-4.8.3/configure -embedded x86 -no-qt3support -xplatform qws/linux-x86-g++  -no-largefile -exceptions -no-qt3support         -openssl -no-cups -depths 8,16,18,32 -qt-kbd-tty -qt-kbd-qvfb -qt-kbd-linuxinput -qt-mouse-linuxinput -qt-mouse-qvfb -qt-mouse-pc -opensource -plugin-gfx-linuxfb -plugin-gfx-qvfb -plugin-gfx-transformed

在我的 eeepc 901 上測試 linux fb 時, 需要移除 i915 module (我直接刪除 i915*.ko), 並且安裝 v86d, 再 modprobe uvesafb, 然後使用 fbset 設定顏色素, 要不然執行都會得到 segment fault。i915 gpu module 除了補強 x driver 外, 似乎還有著 framebuffer 的功能。

fbset -xres 640 -yres 480 -vxres 640 -vyres 480 -depth 8

也可以單純改顏色 16bit。
fbset -depth 16

左邊是 16 bit color, 右邊是 8bit color。

執行指令:
QWS_DISPLAY=LinuxFb:/dev/fb0:depth=16 ./analogclock -qws



旋轉的部份沒有測試成功, 就算加上 -plugin-gfx-transformed, 一直 segment fault。

旋轉部份:
-qt-gfx-transformed 編譯參數

QWSDisplay::setTransformation (1); 加入 qt 程式碼


descent@linux:qt-4.8.3-embedded-x86$
make
sudo make install

設定旋轉的環境變數:
QWS_DISPLAY=LinuxFb:/dev/fb0:depth=16 ./analogclock -qws -display transformed:Rot90

ref:
qt embedded 相關參數

2012年6月6日 星期三

in windows xp using mingw build qt 4.8.2 Input line too long

使用 mingw 在 windows xp 下, build qt 4.8.2 遇到 Input line too long error。


g++ -c -Wall -Wextra -Wreturn-type -fno-strict-aliasing -Wcast-align -Wchar-subscripts -Wformat-security -Wreturn-type -Wno-unused-parameter -Wno-sign-compare -Wno-switch -Wno-switch-enum -Wundef -Wmissing-noreturn -Winit-self -frtti -fexceptions -mthreads -DUNICODE -DQT_LARGEFILE_SUPPORT -DNDEBUG -DBUILDING_QT__=1 -DQT_ASCII_CAST_WARNINGS -DENABLE_XSLT=0 -DENABLE_WEB_TIMING=0 -DENABLE_JAVASCRIPT_DEBUGGER=1 -DENABLE_DATABASE=1 -DENABLE_EVENTSOURCE=1 -DENABLE_OFFLINE_WEB_APPLICATIONS=1 -DENABLE_DOM_STORAGE=1 -DENABLE_ICONDATABASE=1 -DENABLE_CHANNEL_MESSAGING=1 -DENABLE_DIRECTORY_UPLOAD=0 -DENABLE_FILE_SYSTEM=0 -DENABLE_QUOTA=0 -DENABLE_SQLITE=1 -DENABLE_DASHBOARD_SUPPORT=0 -DENABLE_FILTERS=1 -DENABLE_XPATH=1 -DENABLE_WCSS=0 -DENABLE_SHARED_WORKERS=1 -DENABLE_WORKERS=1 -DENABLE_XHTMLMP=0 -DENABLE_DETAILS=1 -DENABLE_METER_TAG=1 -DENABLE_PROGRESS_TAG=1 -DENABLE_BLOB=1 -DENABLE_NOTIFICATIONS=1 -DENABLE_INPUT_SPEECH=0 -DENABLE_INSPECTOR=1 -DENABLE_3D_RENDERING=1 -DENABLE_WEB_AUDIO=0 -DENABLE_WEBGL=0 -DENABLE_MEDIA_STATISTICS=0 -DENABLE_VIDEO_TRACK=0 -DENABLE_TOUCH_ICON_LOADING=0 -DENABLE_ANIMATION_API=0 -DENABLE_SVG=1 -DENABLE_SVG_FONTS=1 -DENABLE_SVG_FOREIGN_OBJECT=1 -DENABLE_SVG_ANIMATION=1 -DENABLE_SVG_AS_IMAGE=1 -DENABLE_SVG_USE=1 -DENABLE_DATALIST=1 -DENABLE_TILED_BACKING_STORE=1 -DENABLE_NETSCAPE_PLUGIN_API=1 -DENABLE_WEB_SOCKETS=1 -DWTF_USE_QT_BEARER=1 -DENABLE_TOUCH_EVENTS=1 -DENABLE_VIDEO=0 -DSQLITE_CORE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_COMPLETE -D_HAS_TR1=0 -DBUILDING_JavaScriptCore -DBUILDING_WTF -DBUILDING_WEBKIT -DQT_MAKEDLL -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\..\include\QtCore" -I"..\..\..\..\..\include\QtNetwork" -I"..\..\..\..\..\include\QtGui" -I"..\..\..\..\..\include" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\ThirdParty" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\assembler" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\bytecode" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\bytecompiler" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\heap" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\dfg" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\debugger" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\interpreter" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\jit" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\parser" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\profiler" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\runtime" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\wtf" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\wtf\gobject" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\wtf\symbian" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\wtf\unicode" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\yarr" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\API" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\ForwardingHeaders" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\JavaScriptCore\generated" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bridge\qt" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\page\qt" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\graphics\qt" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\network\qt" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\qt" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebKit\qt\Api" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebKit\qt\WebCoreSupport" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\accessibility" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bindings" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bindings\generic" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bridge" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\css" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\dom" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\dom\default" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\editing" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\fileapi" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\history" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\html" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\html\canvas" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\html\parser" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\html\shadow" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\inspector" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\loader" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\loader\appcache" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\loader\archive" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\loader\cache" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\loader\icon" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\mathml" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\notifications" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\page" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\page\animation" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\animation" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\audio" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\graphics" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\graphics\filters" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\graphics\filters\arm" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\graphics\texmap" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\graphics\transforms" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\image-decoders" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\leveldb" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\mock" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\network" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\sql" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\text" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\text\transcoder" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\plugins" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\rendering" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\rendering\mathml" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\rendering\style" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\rendering\svg" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\storage" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\svg" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\svg\animation" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\svg\graphics" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\svg\graphics\filters" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\svg\properties" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\testing" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\webaudio" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\websockets" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\wml" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\workers" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\xml" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bridge\jsc" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bindings\js" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bindings\js\specialization" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\bridge\c" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\testing\js" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\generated" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\include" -I"..\include\QtWebKit" -I"..\include" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\sqlite" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\win" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\plugins\win" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\win" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\platform\graphics\win" -I"..\..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore" -I"." -I"d:\qt-everywhere-opensource-src-4.8.2\mkspecs\win32-g++" -o tmp\obj\debug_shared\AccessibilityImageMapLink.o d:\qt-everywhere-opensource-src-4.8.2\src\3rdparty\webkit\Source\WebCore\accessibility\AccessibilityImageMapLink.cpp

果然是有夠長的指令。

ref: http://www.mail-archive.com/kde-windows@kde.org/msg02083.html

沒解決, 因為有另外的問題。

2012年6月1日 星期五

build qt 4.8 using qpa

qt 4.8 使用了新的架構來處理不同的繪圖系統, 在 qt 4.8 稱為  QtLighthouse, qt5 已經改為使用這個架構。在 qt 4.8 則同時有舊的方式和新的架構。就讓我們用 qpa 來編譯 qt 4.8 吧!

$ ls qt-everywhere-opensource-src-4.8.2/src/plugins/platforms

blackberry  eglconvenience      fb_base         linuxfb   platforms.pro  vnc      xlib
cocoa       eglfs               fontdatabases   minimal   qvfb           wayland
directfb    externalplugin.pri  glxconvenience  openkode  uikit          xcb

在 linux/X 上, 我們需要 xcb 這個 plugin 來完成繪圖的動作。xlib 我猜是舊的 qt 用的, qt5 已經強迫使用 xcb。

這裡我使用了shadow build 的方式。建立 qt.x11.x86.qpa 目錄, 在這目錄 compile qt。


../qt-everywhere-opensource-src-4.8.2/configure -no-qt3support -qpa  -opensource
make
make install

安裝後的目錄不是熟悉的 Qt-4.8.2, 而是 QtLighthouse-4.8.2,

$ ls QtLighthouse-4.8.2/plugins/platforms/

libqminimal.so


只有 libqminimal.so plugin, 沒有 xcb, 這個 plugin 無法顯示圖形。


我修改了 qt-everywhere-opensource-src-4.8.2/src/plugins/platforms/platforms.pro
加入
SUBDIRS += xcb
強迫使用 xcb, 這樣就會有 libxcb.so。前題要安裝 xcb 的開發檔案。
xcb 安裝請參考:
http://qt-project.org/wiki/Building_Qt_5_from_Git


至於使用 qpa 編譯出來的程式加上 -platform 就可以指定使用哪個 plugin。
./qt_tetris -platform xcb

2011年8月23日 星期二

替 windows 版本的 qt 找個 compiler

在 linux 上沒什選擇, 幾乎就是使用 gcc, windows qt 可以用好幾個版本的 c++ compiler, 不過我偏好使用 mingw (一樣是 gcc), 要自己搞定 mingw 似乎不大容易, 之前都是使用 qt 包好的版本, qt 會提供有支援 mingw 的安裝檔, 只要一安裝, 就會下載 mingw 並設定好 dos 視窗, 現在下載 qtsdk 也會有類似的效果。

20120606 補充: 目前需要下載 qt sdk (http://qt.nokia.com/downloads/sdk-windows-cpp), 安裝時自己選擇 mingw, 就會安裝好 mingw 了。不過要自己設定 mingw path, 也會安裝 qt creator。


通常我會再安裝 gnu win32 make, 其實 mingw32-make.exe 就是了, 但是我習慣 make 這指令, 所以另外安裝, 直接改名也許方便些, 不過我不想亂動原來的環境。

shadow build (不在 qt source tree 目錄編譯): 在 windows 上使用 shadow build 需要 perl, 所以要安裝 perl 並把 perl path 指定在 PATH 環境變數。shadow build 可以讓我方便編譯 dynamic 和 static 的版本, 所以我會使用 shadow build。

在搞定 c++ compiler 之後, 比較令人討厭的是動態聯結, 好不容易寫了個 hello qt, 由於會缺乏 qt lib 的 dll, 所以會有一堆的 qt lib dll 找不到的訊息, copy 這個執行檔案到 %QTDIR%\bin, 再一次高興的按下執行檔的名稱, 卻發現 mingwm10.dll 找不到的訊息, 從 mingw 安裝目錄找出來, copy %QTDIR%\bin, 再按下執行檔的名稱, 又來了, 換成 libgcc_s_dw2-1.dll 找不到, 再 copy 到 %QTDIR%\bin, 總算看到 hello qt 出來了。

很麻煩是吧!也許可以考慮使用靜態聯結的方式。請參考:
in windows using static link for QT application

依照我的經驗, webkit 需要使用 dynamic link, 不確定其他的 library 會不會也一定要用 dynamic link。

2011年8月22日 星期一

build database drvier (mysql/postgresql) plugin in linux environment - qt4

mysql

./configure -plugin-sql-mysql -plugin-sql-db2 -plugin-sql-ibase
-plugin-sql-mysql -plugin-sql-oci -plugin-sql-odbc -plugin-sql-psql
-plugin-sql-sqlite -plugin-sql-sqlite2 -plugin-sql-sqlite_symbian
-plugin-sql-tds -no-qt3support

If got odbc error message:
ODBC support cannot be enabled due to functionality tests!
Turn on verbose messaging (-v) to ./configure to see the final report.
If you believe this message is in error you may use the continue

這不一定是 odbc 出問題, 在我的系統上是 db2 出了問題, 也會產生這 message, 加上 -v 就清楚了, -v 會列出更多的訊息,可以用來判斷是哪裡出問題。不過 windows 版本似乎要到開始 compile 才會發生問題, 而不是在 configure 階段就秀出問題。

./configure -plugin-sql-mysql -plugin-sql-db2 -plugin-sql-ibase
-plugin-sql-mysql -plugin-sql-oci -plugin-sql-odbc -plugin-sql-psql
-plugin-sql-sqlite -plugin-sql-sqlite2 -plugin-sql-sqlite_symbian
-plugin-sql-tds -no-qt3support -v

我最後的 command:
./configure -plugin-sql-mysql -plugin-sql-odbc -plugin-sql-sqlite
-no-qt3support -v

所以 db2 沒辦法通過 configure 測試是很正常的, 我的系統根本沒有安裝 db2 開發工具, 怎麼有辦法編譯出 db2 的 sql plugin。

odbc support 要安裝:
apt-get install odbcinst odbcinst1debian2 unixodbc unixodbc-dev

所以記得在編譯前先安裝好 mysql 開發相關檔案。
apt-get install mysql-server-core-5.1 libmysqlclient-dev 


最簡單的方式是使用套件商幫我們 build 好的 binary:
apt-get install libqt4-sql-odbc

輕鬆搞定。


不過身為程式開發人員, 把這些事情搞清楚是很重要的。

postgresql

postgresql 也是一樣的行為。

安裝 postgresql 開發套件:
root@ubuntu:/home/descent# apt-get install postgresql-8.4 postgresql-server-dev-8.4
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:

comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit7 libkadm5srv-mit7 
libkdb5-4 libkrb5-dev libpq-dev libpq5 libssl-dev postgresql-client-8.4 
postgresql-client-common postgresql-common 
Suggested packages: 
krb5-doc krb5-user postgresql-doc-8.4 oidentd ident-server 
The following NEW packages will be installed: 
comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit7 libkadm5srv-mit7 
libkdb5-4 libkrb5-dev libpq-dev libpq5 libssl-dev postgresql-8.4 
postgresql-client-8.4 postgresql-client-common postgresql-common 
postgresql-server-dev-8.4

2009年1月30日 星期五

in windows using static link for QT application

qt static link application:
http://blog.lugru.com/2009/03/qt-static-mingwm10dll-and-deployment-under-windows-environment/

需要修改 %qtdir%\mkspecs\win32-g++\qmake.conf,
QMAKE_LFLAGS = -static -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc


這樣可以編譯出 static link 的執行檔案, 不需要附加一堆 dll 檔案 (qt windows version)。

使用以下的 configure 參數來編譯 QT:

configure -static -release -no-exceptions -no-qt3support

sql support:
configure -static -release -no-exceptions -no-qt3support -qt-sql-mysql -qt-sql-odbc -qt-sql-sqlite -no-opengl

不過在 qt-4.6.2 有問題, 編譯到後方, 有些錯誤訊息:

e:\qt-everywhere-opensource-src-4.6.2\lib\libQtWebKit.a(MediaPlayerPrivatePhonon
.o):MediaPlayerPrivatePhonon.cpp:(.text+0xfc1): undefined reference to `_imp___Z
N6Phonon10createPathEPNS_9MediaNodeES1_'
e:\qt-everywhere-opensource-src-4.6.2\lib\libQtWebKit.a(MediaPlayerPrivatePhonon
.o):MediaPlayerPrivatePhonon.cpp:(.text+0xfd0): undefined reference to `_imp___Z
N6Phonon4PathD1Ev'
collect2: ld returned 1 exit status
mingw32-make[5]: *** [..\..\..\..\bin\assistant.exe] Error 1
mingw32-make[5]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant/tools/assistant'
mingw32-make[4]: *** [release] Error 2
mingw32-make[4]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant/tools/assistant'
mingw32-make[3]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[3]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant/tools'
mingw32-make[2]: *** [sub-tools-make_default-ordered] Error 2
mingw32-make[2]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant'
mingw32-make[1]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools'

mingw32-make: *** [sub-tools-make_default-ordered] Error 2

但是有產生出 qt library, 我用來編譯程式, 沒有問題, 可以產生 static 版本的 qt 程式。
後來得知是 webkit 無法 static link, 所以有上述的錯誤訊息。

換成以下的 configure 參數:
configure -static -release -no-exceptions  -no-qt3support -no-dsp -no-s60 -no-webkit 

就可以了。而 qt 4.7 則會判斷這個問題, 若使用 static link, webkit 將不會被編進去 qt library。

windows only:
-no-sdp

2008年12月23日 星期二

qt static link

qt static link application:
http://blog.lugru.com/2009/03/qt-static-mingwm10dll-and-deployment-under-windows-environment/

需要修改 %qtdir%\mkspecs\win32-g++\qmake.conf,
QMAKE_LFLAGS = -static -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc


這樣可以編譯出 static link 的執行檔案, 不需要附加一堆 dll 檔案 (qt windows version)。

使用以下的 configure 參數來編譯 QT:

configure -static -release -no-exceptions -no-qt3support

不過在 qt-4.6.2 有問題, 編譯到後方, 有些錯誤訊息:

e:\qt-everywhere-opensource-src-4.6.2\lib\libQtWebKit.a(MediaPlayerPrivatePhonon
.o):MediaPlayerPrivatePhonon.cpp:(.text+0xfc1): undefined reference to `_imp___Z
N6Phonon10createPathEPNS_9MediaNodeES1_'
e:\qt-everywhere-opensource-src-4.6.2\lib\libQtWebKit.a(MediaPlayerPrivatePhonon
.o):MediaPlayerPrivatePhonon.cpp:(.text+0xfd0): undefined reference to `_imp___Z
N6Phonon4PathD1Ev'
collect2: ld returned 1 exit status
mingw32-make[5]: *** [..\..\..\..\bin\assistant.exe] Error 1
mingw32-make[5]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant/tools/assistant'
mingw32-make[4]: *** [release] Error 2
mingw32-make[4]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant/tools/assistant'
mingw32-make[3]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[3]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant/tools'
mingw32-make[2]: *** [sub-tools-make_default-ordered] Error 2
mingw32-make[2]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools/
assistant'
mingw32-make[1]: *** [sub-assistant-make_default-ordered] Error 2
mingw32-make[1]: Leaving directory `E:/qt-everywhere-opensource-src-4.6.2/tools'

mingw32-make: *** [sub-tools-make_default-ordered] Error 2


但是有產生出 qt library, 我用來編譯程式, 沒有問題, 可以產生 static 版本的 qt 程式。

換成以下的 configure 參數:
configure -static -release -no-exceptions  -no-qt3support -no-dsp -no-s60 -no-webkit 

就可以了。
windows only:
-no-sdp

2008年12月14日 星期日

compile qt source code (0) - mac osX 10.4 ppc/intel

20100323 新增
qt-everywhere-opensource-src-4.6.2.tar.gz

OS: mac osX 10.4 powerpc

gcc/g++ version: powerpc-apple-darwin8-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5564)

mac osX 10.4 只能使用 xcode 2.5, 不能用 xcode 3.X
用 xcode 的 gcc 4.0.1 會有 internal error 的怪問題。

所以需要 gcc 4.2.1 的版本。
gcc/g++ 4.2.1 請到以下 url 下載:
http://r.research.att.com/tools/#gcc42
太神奇了, 這竟然是 ppc/intel 都可以用的版本。
macds:~/usr/bin descent$ file gcc-4.2
gcc-4.2: Mach-O universal binary with 2 architectures
gcc-4.2 (for architecture i386): Mach-O executable i386
gcc-4.2 (for architecture ppc): Mach-O executable ppc


PowerPC 的 MAC (1.42 GHz PowerPC G41 GB DDR SDRAM )
./configure -no-qt3support
make


You maybe get the error message

cd tools/ && make -f Makefilecd assistant/ && make -f Makefile g++
-headerpad_max_install_names -Xarch_ppc -mmacosx-version-min=10.4 -arch
ppc -o ../../../../bin/Assistant.app/Contents/MacOS/Assistant .obj/debug-shared/fontpanel.o
.obj/debug-shared/helpviewer.o .obj/debug-shared/main.o
.obj/debug-shared/mainwindow.o .obj/debug-shared/indexwindow.o
.obj/debug-shared/topicchooser.o .obj/debug-shared/contentwindow.o
.obj/debug-shared/searchwidget.o .obj/debug-shared/preferencesdialog.o
.obj/debug-shared/filternamedialog.o .obj/debug-shared/centralwidget.o
.obj/debug-shared/installdialog.o .obj/debug-shared/bookmarkmanager.o
.obj/debug-shared/remotecontrol.o .obj/debug-shared/cmdlineparser.o
.obj/debug-shared/aboutdialog.o .obj/debug-shared/qtdocinstaller.o
.obj/debug-shared/moc_fontpanel.o .obj/debug-shared/moc_helpviewer.o
.obj/debug-shared/moc_mainwindow.o .obj/debug-shared/moc_indexwindow.o
.obj/debug-shared/moc_topicchooser.o .obj/debug-shared/moc_contentwindow.o
.obj/debug-shared/moc_searchwidget.o .obj/debug-shared/moc_preferencesdialog.o
.obj/debug-shared/moc_filternamedialog.o .obj/debug-shared/moc_centralwidget.o
.obj/debug-shared/moc_installdialog.o .obj/debug-shared/moc_bookmarkmanager.o
.obj/debug-shared/moc_remotecontrol.o .obj/debug-shared/moc_aboutdialog.o
.obj/debug-shared/moc_qtdocinstaller.o .obj/debug-shared/qrc_assistant.o
.obj/debug-shared/qrc_assistant_images.o
-F/Users/descent/qt-everywhere-opensource-src-4.6.2/lib
-L/Users/descent/qt-everywhere-opensource-src-4.6.2/lib
-L/Users/descent/qt-everywhere-opensource-src-4.6.2/plugins/sqldrivers
-framework QtHelp -L/Users/descent/qt-everywhere-opensource-src-4.6.2/lib
-F/Users/descent/qt-everywhere-opensource-src-4.6.2/lib -framework QtWebKit
-framework phonon -framework QtXmlPatterns -framework QtSql -framework QtXml
-framework QtGui -framework QtNetwork -framework QtCore
/usr/libexec/gcc/powerpc-apple-darwin8/4.2.1/ld:
warning can't open dynamic library: 
/usr/local/Trolltech/Qt-4.6.2/lib/libQtCLucene.4.dylib 
referenced from:
/Users/descent/qt-everywhere-opensource-src-4.6.2/lib/QtHelp.framework/QtHelp
(checking for undefined symbols may be affected) (No such file or directory,
errno = 2)/usr/libexec/gcc/powerpc-apple-darwin8/4.2.1/ld: Undefined symbols:


cp libQtCLucene.4.dylib to /usr/local/Trolltech/Qt-4.6.2/lib/

I use symbol link let /usr/local/Trolltech/Qt-4.6.2/lib/ link to Qt-4.6.2/lib
ln -s ~descent/qt-everywhere-opensource-src-4.6.2/lib .

可以用 mac port 安裝 qt4
sudo port install qt4-mac

可能也會遇到類似的問題, 可參考 ref: http://trac.macports.org/ticket/23284


Old part:

wget ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-src-.4.3.tar.bz2

目前抓的是這版, 是 mac 的版本, X, ms windows, 都是一樣的編譯方式。
tar jxvf qt-mac-opensource-src-.4.3.tar.bz2

由於我不想編譯 qt3 的相容部份, 所以使用下面的參數, 這樣比較快。

./configure -no-qt3support
make

即可。 mac 版本有提供 precompile 版本, 就不用自己編譯了, 因為編譯 qt 空間要佔不少,
時間也要很久。

在我的 mac mini core duo 2.33 2g ram 上, 花費的時間。
不編譯 qt3 相容 library。

▼ qt-mac-opensource-src-4.4.3 compile time
real    137m59.436suser    94m57.319ssys     20m59.228s

▼ qt-mac-opensource-src-4.3.5 compile time
real    68m13.734suser    56m17.982ssys     10m0.747s

▼ qt-mac-opensource-src-4.2.2 compile time
real    52m58.058suser    40m45.525ssys     7m56.525s

版本越新, 功能越多, compile 時間越慢。 PowerPC 的 MAC
1.42 GHz PowerPC G41 GB DDR SDRAM

▼ qt-mac-opensource-src-4.3.5 compile time
real    278m33.604suser    161m11.483ssys     30m20.600s

這是使用 usb 外接硬碟, 看來 intel core duo 2.33 效能贏很多阿!