Tag Archives: Programming

How to embed an Info.plist into arbitrary binaries

For an application on OS X, the Info.plist file is very common. But could we embed it into the binaries?

Yes, we can. There is a compiler option “–sectcreate __TEXT __info_plist Info.plist”.

One example is the .pro file for qmlplugindump in qtdeclrative, change 4d173d5f16c103f640d4089feed44a74b14e9004.

I learned it from ariya‘s commit in phantomjs: 71425850f61ad85e33741ed5a59364327532f6a8.

And today I read an article: Gimmedebugah: how to embedded a Info.plist into arbitrary binaries, which also mentioned this. And it gives me the Apple documentation for that, Code Signing Tasks: Adding an Info.plist to Single-File Tools.

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:

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!

原来挪威在计算机历史上还是很强的

在挪威工作前后,知道这里有原Fast Search,现Microsoft的一个子公司Opera原Trolltech,现Qt, Nokia。加上瑞典的MySQL,被Sun, Oracle依次收购。只是觉得北欧在计算机领域还是有一席之地的。

最近在看Cocoa Programming Developer’s Handbook,提到了SimulaC++影响很大,才知道Simula竟然是挪威制造

体会了一下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

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!