Tag Archives: Qt

How to debug into Qt library in Qt Creator with CDB

OS: Windows 7 64bit SP1 (Note: need to have .Net 4 installed)

SDK: Windows SDK 7.1 x86_64 (Note: remember to have “Visual C++ Compilers” and “Debugging Tools for Windows” installed)

Qt Creator: Qt Creator 2.6.2 in qt-windows-opensource-5.0.1-msvc2010_32-x86-offline-2013-01-30-426.exe (Note: I am testing 5.0.1 daily build packages, 5.0.0 release doesn’t ship with .pdb files)

Qt Creator 2.6.2 could detect the compiler and cdb correctly from above environments after installed. What you need to do are only two things:

  1. Tools->Options->Debugger->CDB, In the Symbol paths field, open the Insert menu and select Symbol Server, just use default value and click OK
  2. Tools->Options->Debugger->General, in Source Paths Mapping part, click Add, set Source path field to q:\qt5_workdir\w\s and Target path field to C:\Qt\Qt5.0.1\5.0.1\Src

Then you can debug into Qt library in your applications.

Reference:

Update:

Some information about CI and build, release in qt-project

Just some information, not details:

Clues of Qt on Android and iOS

Just for who are interested in the status of Qt on Android and iOS, and want to contribute to it.

Qt on Android

Mainstream: Qt 4.8 and QtBase(Qt 5.0)

Run the following command in 4.8 branch of Qt repo and master branch in QtBase repo:

Folk: Necessitas

There is a folk, Necessitas, which is based on Qt 4.x.

Note: At least by now, it is not merged into mainline.

If you want to contribute to it, please read KDE Necessitas project: Get involved. You can find bug reports, todo list, mailing list and irc channel.

The most important one is code repository.

Qt on iOS

Mainstream 1: Qt 4.8 and QtBase(Qt 5.0)

Run the following command in 4.8 branch of Qt repo and master branch in QtBase repo:

Mainstream 2: iOS branch in QtBase(Qt 5.0)

Here is the commit history of ios branch.

Note:

How to find the changes which people are working on? Search this in codereview:

Reference: gerrit doc: Searching Changes

Update:
2012-11-08 Digia: Necessitas Android Port Contributed to the Qt Project

To be updated in future.

如何为Qt做贡献

项目不只是Qt了,应该算是Qt家族吧,例如Qt Creator等。

任务也不只是写代码了,界面、文档的汉化等等,本文都有涉及。

Qt已经Open Governance了,所有上述工作都可以走这个路径,也就是直接贡献给上游。泛泛的介绍可以看Contribute to Qt,具体的步骤:

  • 帐号:注册Jira帐号,这个帐号会被同步到codereview
  • 协议:登陆上面提到的codereview站点,点击右上角的Settings,再点击左栏下方的Agreements,点击New Contributor Agreement,一般个人都是接着选择Individual,具体协议内容在这里就不再赘述了。在文本输入框中输入I AGREE后,点击Submit Agreement。
  • SSH公钥:还是codereview站点,点击右上角的Settings,再点击左栏中部的SSH Public Keys,上传你的SSH公钥,玩过github之类网站的应该都清楚。
  • Gerrit/Git的使用方式:详见Setting Up Gerrit。其中比较重要的一步就是commit-msg,配置正确的话,在git commit之后,commit msg里就会出现Change-Id字段。另外强烈建议在最后git push之前找现有的Approver或者Maintainer帮你查看一下。
  • 上述变更在git push之后会进入codereview,然后就是和Approver或者Maintainer进行交互,直到最后完成,通常的沟通方式就是IRC或者邮件列表

Qt的界面文件翻译,一般就是.ts文件的翻译,相关过程可以参考Translating Qt Into Other Languages,需要注意的是提交的时候有特别操作:

  • 方法一:不运行git commit, 在翻译文件所在目录,运行make commit-ts
  • 方法二:运行lconvert -locations none -i yours.ts -o yours.ts,然后git commit

主要是要把.ts文件中的易变的location信息去掉。

Qt的文档翻译,鉴于现在的qdoc功能有限,对于那些类的说明(文档都放在了源代码中),目前还无法处理。但对于综述性的单独.qdoc文件是可以翻译的,例如Qt 4源码仓库中的doc/src/目录是英文文档,翻译好的简体中文文档都应该放在doc/src/zh_CN/下,请保持相同的子目录结构。Translating Qt Into Other Languages中的Translating Qt Documentation Into Other Languages一节介绍了如何从.qdoc文件生成.html文件。

Qt Project的wiki翻译,请大家把简体中文的翻译直接放在主站上,目前对于wiki页面名称好像没有一致的规定,例如:Building Qt 5 from Git构建来自 Git 的 Qt 5,页面名称中增加了-SimplifiedChinese,好像还有用_SimplifiedChinese的和_Chinese等情况,我这里比较推荐_SimplifiedChinese。另外不建议在wiki页面中加入译者博客链接之类的个人信息,请在自己的用户页面添加这些信息,例如这里是我在qt-project的个人页面。

如果大家对上述工作感兴趣,在实际操作中遇到问题,欢迎在qt-cn频道联系我(lqi)。

2012-10-25: 更新。WordPress的markdown格式有些问题,现在用的是Markdown on Save Improved。

Clang Static Analyzer with Qt

1. OS: Snow Leopard 64bit

2. Qt: 4.8

cd ~/qt
git clone git://gitorious.org/qt/qt.git work
cd work
git checkout -b origin/4.8 4.8
cp -rf mkspecs/unsupported/macx-clang mkspecs/unsupported/macx-checker

Note: a patch for mkspecs/unsupported/macx-checker/qmake.conf: http://pastebin.com/u7mnkhue

3. Clang Static Analyzer: checker-256

cd ~/dev/packages
wget http://clang-analyzer.llvm.org/checker/checker-256.tar.bz2
tar zxvf checker-256.tar.bz2
cd checker-256
rm bin/clang
rm bin/clang++
cd /usr/local/bin
ln -s /Users/liangqi/dev/packages/checker-256/bin/clang-3.0 clang
ln -s /Users/liangqi/dev/packages/checker-256/bin/clang-3.0 clang++

4. Build

cd ~/build
mkdir qt-48-clang
cd qt-48-clang
export PATH=/usr/local/bin:/Users/liangqi/dev/packages/checker-256:$PATH
/Users/liangqi/qt/work/configure -platform unsupported/macx-checker -nokia-developer -no-webkit -no-qt3support -no-declarative -no-xmlpatterns -no-script -no-scripttools -no-phonon -no-multimedia -nomake tools -nomake demos -nomake examples -fast -verbose -no-framework
scan-build make

5. Output

In the end of the output, you will find a command like “scan-build: Run ‘scan-view /var/folders/QB/QBTpJfK+HfqtpmxTOms2nU+++TI/-Tmp-/scan-build-2011-07-20-3’ to examine bug reports.”, do it!

NOTE: the above way doesn’t work with checker-257!

How to run autotests in Qt for Symbian on Linux and Mac?

Here is the official article for it, Installing Qt for the Symbian platform using Linux (experimental).

The basic idea is same on Linux and Mac OS X.

1. For phone, you need to install Application TRK

S60 5.0/Symbian^1 – s60_5_0_app_trk_3_2_7.sisx
Symbian^3 – s60_tb_9_2_app_trk_3_2_8.sisx

2. Use usb cable to connect your phone and computer, Linux or Mac OS X. Remember to set to “PC Suite” mode or “Nokia Ovi Suite” mode on your phone. Then launch your Application TRK via “RnD Tools”->”TRK”.

3. About the device name for your phone on computer

For Linux, see more details in Configuring the USB Serial Driver on the Linux System. After that, you will find /dev/ttyUSBx and maybe another /dev/ttyUSBy, better to “sudo chmod 777 /dev/ttyUSB*” for them(some Linux distribution do not give the access to normal users for it, like Ubuntu).

For Mac, you could find sth like /dev/cu.usbmodemfaXx and /dev/cu.usbmodemfaXy.

4. To build runonphone, you need to have libusb installed.

For Linux, just follow that documentation, “sudo apt-get install libusb-dev” should be ok for Debian/Ubuntu.

For Mac, “sudo brew install libusb-compat” works for me.

5. Build runonphone, use the qmake in your desktop Qt.

cd ~/qt/qt/tools/runonphone
/usr/bin/qmake
make

6. Build and run your autotests, please check previous blog for the EPOCROOT and PATH environments settings.

cd qt/qt/tests/auto/qdatetime
~/build/s3_gcce/bin/qmake -spec ~/qt/qt/mkspecs/symbian-gcce -o Makefile ~/qt/qt/tests/auto/qdatetime/qdatetime.pro
make sis
~/qt/qt/tools/runonphone/runonphone -p /dev/cu.usbmodemfa44 –sis ~/qt/qt/tests/auto/qdatetime/qdatetime.sis qdatetime.exe

NOTE: Here the /dev/cu.usbmodemfa44 is the device on Mac for me. And for Linux, the device is sth like /dev/ttyUSB1.

Enjoy it!

Build Qt 4.7 with Symbian^3 on Linux and Mac OS X

Similar steps as previous blog.

Here I will only mention the difference between them:

1. Qt 4.7, please wait a while for the merging of 7c499bcfbf7f9c52b3d6523fea8396bd4ab7252e.

git checkout -b 4.7 origin/4.7

2. You could enable the webkit which is inside of 4.7, then the configure line should be like:

~/qt/qt/configure -developer-build -opensource -confirm-license -xplatform symbian-gcce -webkit -fast -silent -nomake examples -nomake demos -nomake tools -nomake tests -qtlibinfix _liang

And for QtWebKit package:

cd ~/build/s3_gcce/src/3rdparty/webkit/WebCore
make sis
copy ~/build/s3_gcce/lib/QtWebKit_liang.sis toyourphone

For the demo browser application:

cd ~/qt/work/demos/embedded/anomaly
make sis
copy anomaly.sis toyourphone

3. Install the above Qt_liang.sis, QtWebKit_liang.sis, analogclock.sis and anomaly.sis, and enjoy them.

Launch it at “QtExamples”->”analogclock”.
Launch it at “QtDemos”->”anomaly”.

Build Qt 4.8 with Symbian^3 on Linux and Mac OS X

Build Qt 4.8 with Symbian^3 on Linux and Mac OS X

Kudos to Kristian Amlie and Thomas Zander for the “make file build system”.

1. OS:

Linux – mine is 2.6.38-8-generic x86_64
Mac OS X – mine is 10.6.8 64bit

2. Symbian^3

NOTE: Looks like Qt is still not the 1st-priority citizen in the Symbian^3 SDKs world, the reason why I say like that is this task, it means that you cannot use any version of Symbian^3 (public) SDKs to build Qt libraries from source. Details in the comment. Then we use the Symbian^3 PDK 3.0.4 for now. I am not sure how long this mirror service will be available there, you’d better backup those files by yourself.

Symbian^3 PDK 3.0.4

Please download binaries_armv5_lib.7z.zip, binaries_armv5_udeb.7z.zip, binaries_armv5_urel.7z.zip, binaries_epoc.7z.zip, binaries_epoc_sdk.7z.zip, binaries_prebuilt.7z.zip, tools_epoc.7z.zip at least.

cd ~
mkdir -p symbian-sdks/pdk304
cd symbian-sdks/pdk304
7z x abovefiles
export EPOCROOT=~/symbian-sdks/pdk304/ //set env for EPOCROOT

The patch for Symbian^3 PDK 3.0.4 is here.

3. Wine

NOTE: The reason for installing wine is we are using the Symbian tools build on Windows, such as rcomp, makesis and many others.

Linux(Debian/Ubuntu): sudo apt-get install wine1.2
Mac OS X: Install wine 1.1.44, and upgrade it to 1.2

Add wine into path
export PATH=/Applications/Wine.app/Contents/Resources/bin:$PATH //for Mac OS X

4. Compilers:

Linux: RVCT 2.2(need commercial license) or GCCE 4.4.1(Symbian ADT Sourcery G++ Lite 4.4-172 for ARM SymbianOS)
Mac OS X: GCCE 4.4.1(Symbian ADT Sourcery G++ Lite 4.4-172 for ARM SymbianOS), after installed to default path, mv /Applications/CodeSourcery/Sourcery G++ Lite/ /Applications/CodeSourcery/Sourcery_G++_Lite. NOTE: need to remove those spaces in the path of compiler

Add compiler path into PATH:
export PATH=/Applications/CodeSourcery/Sourcery_G++_Lite/bin:$PATH

5. Qt 4.8

NOTE: better to use ea7ed6b27301a4834b1bfe0ad4e6e58462647d3e and later.

cd ~
mkdir qt
git clone -n git://gitorious.org/qt/qt.git qt
cd qt
git checkout -b 4.8 origin/4.8

6. Build it

cd ~
mkdir build
cd build
mkdir s3_gcce // this is for the GCCE case, or s3_armcc for RVCT 2.2 case
cd s3_gcce
~/qt/qt/configure -developer-build -opensource -confirm-license -xplatform symbian-gcce -no-webkit -fast -silent -nomake examples -nomake demos -nomake tools -nomake tests -qtlibinfix _liang // this is for GCCE case, or “-xplatform symbian-armcc” for RVCT 2.2 case
make -j8 // maybe fail at somewhere, then just try “cd src;make -j1” finish it
cd src/s60installs
make sis
cd ~/build/s3_gcce/lib
cp Qt_liang.sis toyourphone
cd ~/qt/qt/examples/widgets/analogclock
~/build/s3_gcce/bin/qmake
make sis
copy analogclock.sis toyourphone

7. Install your own build Qt libraries and application

Goto “Office”->”File Manager”, manually install Qt_liang.sis and analogclock.sis

8. Run your appliation

Launch it at “QtExamples”->”analogclock”. Enjoy it!

Known issues or other topics:
1. There is still some issue to build qtwebkit which the one inside of qt 4.8 or from qtwebkit git repo directly. If I got solution, I will let you know.
2. Mabye write something about runonphone on Linux and Mac OS X, it is a very good tool to test qt applications.