Tag Archives: Qt

Qt中的一些全局测试用例

近期工作中接触过的,觉得很有意义。

目前这些测试用例都还在在$QTDIR/tests/auto下:

bic
说明:利用g++的-fdump-class-hierarchy参数生成的类信息数据和VTable数据检查二进制兼容性。对于库来说很重要。gen.sh对已发布的版本生成历史数据,然后调用g++ -fdump-class-hierarchy生成当前版本数据再进行比较。只要是支持g++的平台都可以检测。

compilerwarnings
说明:tst_CompilerWarnings::warnings()中对几种编译器的警告进行了检测。

headers
说明:tst_Headers::licenseCheck()中对所有源文件进行协议检查。tst_Headers::privateSlots()中对所有头文件检查了私有槽必须含有“_q_”。tst_Headers::macros()对所有头文件检查了宏。

symbols
说明:利用nm检查库中函数名和全局变量。tst_Symbols::prefix()中利用nm -g -C -D –format=posix –defined-only对库中的函数名称的前缀进行检查。tst_Symbols::globalObjects()中利用nm -C –format=posix对库中的全局静态对象进行检测,应该是不能有的。

体会了一下Snow Leopard的一个开发bug

终于在公司搞到了一台旧的iMac 5.1, Intel Core 2 Duo 2.0 GHz/ 2G DDR2 667 MHz。

装上了Snow Leopard和官方发布的Qt 4.7.0 Beta 2Qt Creator 2.1快照版,想debug进Qt库,竟然不成,咨询了公司内外的Mac开发朋友,原来我遇到了Apple的bug。

DYLD_IMAGE_SUFFIX=_debug makes application crash on Mac OS X – Snow Leopard
DYLD_IMAGE_SUFFIX causing havoc on Mac OS X Snow Leopard

而且变态的Apple自己的bug tracker还是封闭的,只有号码,看不到具体情况。

最后的解决办法是:

cd /usr/lib
sudo mv libSystem.B_debug.dylib libSystem.B_debug.dylib.bak
sudo mv libmx.A_debug.dylib libmx.A_debug.dylib.bak

之前还以为/Developers/SDKs/MacOSX10.6.sdk/usr/lib的有效呢。

BTW,学习了OS X下的ldd就是otool

其它参考文档:
Technical Note TN2124: Mac OS X Debugging Magic

2010年7月30日注:升级到XCode 3.2.3后,依然崩溃。

How to support your own type in QVariant

Reference:
Qt 4.6 Documentation: Q_DECLARE_METATYPE

Build Qt with S60 5.0 Public SDK(2nd version)

Build Qt with S60 5.0 Public SDK(2nd version)

Platform: Windows XP with SP3(now we only support Qt/S60 on it.)

1. SYMBIAN Development Environment

For downloading the packages, you need to register an account in the forum of Nokia,
http://www.forum.nokia.com/main/registration/registration.html

1-1. Carbide.C++
http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/IDEs/Carbide.c++/
http://sw.nokia.com/id/7710eba7-4da7-4ddc-a52a-53b506cadb4a/Carbide_cpp_v2_0_en.exe

Carbide.C++ 2.0
Carbide_cpp_v2_0_en.exe 203MB

1-2. S60 Platform SDKs for Symbian OS, for C++
http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html
http://sw.nokia.com/id/577ad48d-290c-4bb5-8bdf-779ea8a5bc6c/S60_5th_Edition_SDK_v1_0_en.zip

S60 Platform SDKs for Symbian OS, for C++, 5th Edition
S60_5th_Edition_SDK_v1_0_en.zip 622MB

1-3. Open C/C++ Plug-in
http://www.forum.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html
http://sw.nokia.com/id/fbe59b85-a621-404b-94d7-94ca818e576a/s60_open_c_cpp_plug_in_v1_6_en.zip

Open C/C++ Plug-in 1.6
s60_open_c_cpp_plug_in_v1_6_en.zip 34MB

2. Installation
Please install following packages as default path.

Install ActivePerl-5.6.1.638-MSWin32-x86.msi.
Install Java SE Development Kit (JDK), JDK 6 Update 16, jdk-6u16-windows-i586.exe
Install Carbide.C++.
After installed Carbide.C++, please download x86Tools_3.2.5_Symbian_b482_qt.zip. Please extract all files in it, and copy or move them to overwrite this folder, C:Program FilesNokiaCarbide.c++ v2.0x86Build.
Please run this, Start->Carbide.c++ v2.0->Configure environment for WINSCW command line.
And you also need to use Git to get Qt from Qt Git Repo, better to download this version of Git.

Please also make sure the path of our perl(default: C:Perlbin) should be before the perl in git(default: C:Program FilesGitbin) in PATH.

For Host Tools:
For MinGW user, please download MinGW-5.1.4.exe(Note: here the 5.1.4 is the version of installer, the compiler version is 3.4.5.), use it install g++ and make at least. And please add the env for MinGW, C:MinGWbin, at the beginning of the PATH.
For Microsoft Visual C++ Express Edition user, please download the vcsetup.exe and install 2008 with SP1.

For Device:
You need to install RVCT 2.2, we are using “Build 683”. You can use RVCT to build Qt libraries and applications which could running on S60 devices.
You can also install the “CSL Arm Toolchain”, if you forgot it, you can find it in Start->S60 Developer Tools->5th Edition SDK->v1.0->Tools->CSL Toolchain (GCCE) Install. You can use GCCE to build Qt applications with pre-build Qt libraries, and run your Qt applications on devices.

3. Build Qt with S60 5.0 Public SDK

For MinGW user, just open a Windows Command Prompt.
For VC2008EE user, please open Visual Studio 2008 Command Prompt.

C:
mkdir git
cd C:git
git clone -n git://gitorious.org/qt/qt.git
cd qt
git checkout -b 4.6 origin/4.6
set PATH=C:gitqt-s60bin;%PATH%

For MinGW user:
configure -platform win32-g++ -xplatform symbian-abld -qt-sql-sqlite -system-sqlite -no-script

For VC2008EE user:
configure -platform win32-msvc2008 -xplatform symbian-abld -qt-sql-sqlite -system-sqlite -no-script

make debug-winscw // for emulator
make release-armv5 // for devices arvm5

4. Build Examples

cd C:gitqtexampleswidgetsanalogclock
qmake
make debug-winscw // for emulator
make release-armv5 // for devices arvm5
make release-gcce // for devices gcce

5. Run

In Emulator:
C:S60devicesS60_5th_Edition_SDK_v1.0epoc32releasewinscwudebepoc.exe
“Menu”(or click the middle one of the 3 buttons)->QtExamples->analogclock

In Device:
createpackage C:gitqtsrcs60installsQt_for_S60_template.pkg release-armv5 // create Qt install package, it locates in C:gitqtsrcs60installsqt_for_s60_release-armv5.sis
createpackage C:gitqtexampleswidgetsanalogclockanalogclock_template.pkg release-armv5 // create analogclock armv5 install package, it locates in C:gitqtexampleswidgetsanalogclockanalogclock_release-armv5.sis
createpackage C:gitqtexampleswidgetsanalogclockanalogclock_template.pkg release-gcce // create analogclock gcce install package, it locates in C:gitqtexampleswidgetsanalogclockanalogclock_release-gcce.sis

Before you install Qt install package, you should also insall following packages:
pips_s60_1_6_SS.sis
openc_ssl_s60_1_6_SS.sis
STDCPP_s60_1_6_SS.sis

You can find them in C:S60devicesS60_5th_Edition_SDK_v1.0nokia_pluginopencs60opencsis and C:S60devicesS60_5th_Edition_SDK_v1.0nokia_pluginopencpps60opencppsis.

NOTE: If you are using virtual machine, please do not use Windows Remote Desktop to connect it. The default audio driver for it will cause S60 Emulator crash.

Build Qt with S60 5.0 Public SDK

Build Qt with S60 5.0 Public SDK

Platform: Windows XP with SP3(now we only support Qt/S60 on it.)

1. SYMBIAN Development Environment

For downloading the packages, you need to register an account in the forum of Nokia,
http://www.forum.nokia.com/main/registration/registration.html

1-1. Carbide.C++
http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/IDEs/Carbide.c++/
http://sw.nokia.com/id/7710eba7-4da7-4ddc-a52a-53b506cadb4a/Carbide_cpp_v2_0_en.exe

Carbide.C++ 2.0
Carbide_cpp_v2_0_en.exe 203MB

1-2. S60 Platform SDKs for Symbian OS, for C++
http://www.forum.nokia.com/info/sw.nokia.com/id/ec866fab-4b76-49f6-b5a5-af0631419e9c/S60_All_in_One_SDKs.html
http://sw.nokia.com/id/577ad48d-290c-4bb5-8bdf-779ea8a5bc6c/S60_5th_Edition_SDK_v1_0_en.zip

S60 Platform SDKs for Symbian OS, for C++, 5th Edition
S60_5th_Edition_SDK_v1_0_en.zip 622MB

2. Installation

Please install above 2 packages as default path.

Installation order: Carbide.C++, S60 SDK.

After Carbide.C++, you may need to install ActivePerl-5.6.1.638-MSWin32-x86.msi:

http://downloads.activestate.com/ActivePerl/Windows/5.6/ActivePerl-5.6.1.638-MSWin32-x86.msi

And you also need to use Git to get Qt from Qt S60 Git Repo, better to download this version of Git.

Please also make sure the path of our perl(default: C:Perlbin) should be before the perl in git(default: C:Program FilesGitbin) in PATH.

Please run this, Start->Carbide.c++ v2.0->Configure environment for WINSCW command line.

3. Build Qt with S60 5.0 Public SDK

cd C:git
git clone git://gitorious.org/+qt-s60-developers/qt/qt-s60.git
cd qt-s60
set PATH=C:gitqt-s60bin;%PATH%
configure -platform win32-mwc -xplatform symbian-abld -openssl-linked -qt-sql-sqlite -system-sqlite
make debug-winscw

4. Build Examples

cd C:gitqt-s60exampleswidgetsanalogclock
qmake
make debug-winscw
C:S60devicesS60_5th_Edition_SDK_v1.0epoc32releasewinscwudebepoc.exe
“Menu”(or click the middle one of the 3 buttons)->QtExamples->analogclock

You got it!