Tag Archives: Qt

Qt 5.5.0 on OS X: fix for ‘-Winconsistent-missing-override’ warning

Qt 5.5.0 officially released on July 1st. But on OS X, for example 10.10.4+Xcode 6.4(clang-602.0.53), you will have lots of warnings about ‘-Winconsistent-missing-override’, like:

Yes, there is a bug report(QTBUG-46833) for it. And the fix is in 7d5e849e.

The solution is:

Go to Line 158, change 6020049 to 7000053. Save it!

The snapshot of Qt5 env at the time a commit was merged by CI

For example, I am reading Gunnar Sletta’s blog, New Scene Graph Renderer.

I guess the change is b480fa83, it’s already merged in stable(5.2.x). After talked with Gunnar, he mentioned that the result in lastest stable is perhaps very different with the blog, because there was another big change, v4, also already in stable.

I think I need to have the environment to reproduce the “scene” at that commit, b480fa83.

First, I had a look at the status of that change.

In the dependencies part, I found:

qtdeclarative depends on qtbase and qtxmlpatterns repo. For this example, just in case, we have an explicit sha1 in qtbase. It’s uncommon. Normally it’s just like the case for qtxmlpatterns, an empty string.

Next, the change in codereview.qt-project.org is this.

I found the latest information when that change was integrated, QtDeclarative_dev_Integration #719: SUCCESS.

In Qt CI results, the results for QtDeclarative_dev_Integration #719, I chose macx-clang_developer-build_OSX_10.8, then I am in this page.

Searching qtbase, you could find some information like:

I think I know what I should do for qtbase and qtxmlpatterns.

Now I could have a shadow build and play with it.

How to setup a mirror of Qt Project

There is a work from Oswald Buddenhagen, his change, qtrepotools: add mirror script.

Mirror Script

You need to have an account of codereview(gerrit) and set up the ssh keys well, more info in Contribute to Qt.

Here is the qt-codereview-mirror shell script in github.

I set up this mirror script on a Ubuntu 13.04 machine. You need to check following before to run it:

  • Install git and procmail package for git and lockfile:

  • Make sure you have /data/repos directory.

You could have a try run for the above script. If it works well for you, you can add it into your crontab, see also Ubuntu: CronHowto.

Git Daemon

Next is to run a git server on your machine. I use git-daemon for this task.

How to use your mirror?

  • For Qt 4:

If you need to push change to upstream, then you should set up gerrit remote.

  • For Qt 5:

init-repository will help you set up gerrit remote for each repo.

Distributed Compilation the build of Qt

Qt is a huge project, especially like the module, QtWebKit. If you happen to be in a computer farm, it is very useful to use distributed complation to speed up the build of Qt.

Here I suggest to use icecream on Linux and Mac OS X, and IncrediBuild on Windows(at least for Microsoft’s Visual Studio compilers). About IncrediBuild, more details perhaps will be updated in the future. See also qtrepotools: publish ibmake.bat, incredibuild xge wrapper for make/buildconsole.

Today, this blog is more about icecc/icecream.

Preparation

Linux

icecream is maintained by the SUSE people. Then there are less issues in OpenSUSE than in Ubuntu. But Ubuntu is more popular one. I just use Ubuntu as example here.

  • Install your compiler, like gcc and clang.
  • Install icecc and icemon(optional). icemon is the monitor of icecream build, better to check it when you setup the enviroments. It’s an GUI application based on Qt 4.8. Note: you need to install 0.9.8~git2012121601-0ubuntu2 and later version for icecc. More details in “icecc” package in Ubuntu.

  • For clang users, if you want to make icecream compiler package, better to do:
    • 13.04: $ sudo ln -s /usr/include/clang/3.2/include /usr/lib/clang/3.2/
    • 12.04: $ sudo ln -s /usr/include/clang /usr/lib/
  • Create compiler package: please do it. Here is the example for 13.04:

  • Enviroment settings before build:

  • Run icecc-scheduler in one of your Ubuntus:
    • Edit /etc/default/icecc, set START_ICECC_SCHEDULER="true".
  • Start icecc service: sudo /etc/init.d/icecc start, icecc-scheduler service also could be started with this. Not suggest to run multiple icecc-scheduler in same network with default values, you could edit /etc/icecc/icecc.conf with more options.
  • Stop icecc service(optional): sudo /etc/init.d/icecc stop

Mac OS X

  • Create a ‘qt’ user. Open System Preferences -> Users & Groups -> “+” under the list of users (you might need to click the lock icon first and type in your password), add a user “qt” with your standard password.
  • Install HomeBrew

  • Install XCode and command line tools.
  • Install icecc and icemon(optional).
  • Create compiler package: please do it. Here is the example for 10.8:

  • Enviroment settings before build: (Note: looks like it doesn’t work well with a compiler package. 2013-06-19)

  • Copy com.github.iceccd.plist into into /Library/LaunchDaemons .
  • sudo chown root /Library/LaunchDaemons/com.github.iceccd.plist
  • Start icecc service: sudo launchctl load /Library/LaunchDaemons/com.github.iceccd.plist
  • Stop icecc service(optional): sudo launchctl unload /Library/LaunchDaemons/com.github.iceccd.plist

Building Qt

Normally just do source ~/.icecc_rc, configure and make.

  • For clang build(both Linux and Mac OS X), please keep in mind to use -no-pch when configure.
  • For Qt4 build, the -arch argument that Qt 4 passes to the compiler confuses icecream. So for now, if you use Qt4, you need to patch your mkspec to not add that (if you build for your local architecture only), eg. in mkspecs/common/gcc-base-macx.conf.(Note: looks like it’s only on Mac OS X, I haven’t tried it yet.)

Known Issues

  • Using icecream currently screws up debug information for all object files that we compiled remotely!(Mac OS X only)

Thanks

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.

Nokia is still working on some Qt projects

Yes, Digia accquired Qt from Nokia last year. But it’s very interesting to see Nokia is still working on some Qt projects.

How do I know it?

Go to Nokia: See the latest career opportunities. Input “qt” in “Keywords” field, and select “Research & Development” in “Job Category” field, click “Search for Jobs” button. At least I got 9 positions, one in US and 8 in Berlin, Germany. It looks like the projects are about Automotive and using Qt and QML.

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.