2008-08-22

Building Qt on a clean Kubuntu

I have to admit it - I always build my own Qt. Because of customers sticking to older versions and myself wanting to have the latest, I currently have 4 flavors of Qt and 3 of QtopiaCore sitting on my laptop.

As I recently invested in a new computer I felt that I had to build Qt + Qtopia on it. The computer was installed with a clean Kubuntu from the start. The problem is that Qt requires some packages to build and finding those packages is (at least for me) a tedious iterative process (make - look what failed - apt-get install it - repeat). So, without further ado, here is a list of packages that you need to get 4.3.4 X11 to build properly:
  • build-essential
  • libx11-dev
  • libxext-dev
So, make sure to apt-get install those before running ./configure && make && make install && echo -e "\a" . At least it keeps you from interrupting your I'm-compiling-thus-working-coffee-break. :-)

Sidenote: I guess Qt 4.4 requires some gstreamer goodies as well, I'll tell you when I get there.

Labels:

2008-08-17

A tip

The Gigabyte GA-MA78G-DS3H motherboard will not boot with 4 GB on board unless you first update the BIOS. This means that if you buy 2x2GB of RAM, you will need to boot using one DIMM, update the BIOS and then insert the second DIMM. Failing to do so will just bring frustration and anger.

2008-08-10

Commercial Qt on Vista using MinGW

Since I just got my new computer up and running, I wanted to start using Qt. Another new, for me, is Vista, so I decided to get my commercial Qt license up and running using MinGW in Vista. The proved to be a small challenge so I've documented my steps here.

First of all, put your license file in your user directory and try to rename it to .qt-license. Notice that the file explorer won't let you do that. Apparently the only dot denotes the start of the file ending, so in Vista's eyes, a file starting with a dot has no name. The solution is, as always, to use a command prompt and good old ren.

I've downloaded MinGW and the commercial Qt sources for win32. These are installed/extracted into the Coding directory located in my home directory (being C:\Users\Thelin in my case). MinGW lives in Coding\MinGW while Qt is in Coding\qt-win-commercial-src-4.4.1.

Building

Let's continue by using a command prompt and set some environment variables to point out these facts. We need to include MinGW in the PATH variable. Then Qt needs the QTDIR and QMAKESPEC variables to get its foothold.
set PATH=%PATH%;C:\Users\Thelin\Coding\MinGW\bin

set QTDIR=C:\Users\Thelin\Coding\qt-win-commercial-src-4.4.1

set QMAKESPEC=%QTDIR%\mkspecs\win32-g++
As we are used to from Unix, we then configure Qt before building it. This is straight forward, but I've included my configure line for completeness.

configure.exe -debug-and-release -shared -plugin-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -no-libtiff -no-gif -no-dsp -no-vcproj -assistant-webkit
The last step of the configuring is the construction of QMake for your configuration. It is good to know that the file pbuilder_pbx.cpp takes ages to build (see TaskTracker #162299). Apparently by design.

When QMake has been built, simply do as told. Run mingw32-make to build Qt. I choose to add the argument -j4 to utilize my CPU cores better. Don't know if it improves the build time much but it makes me feel good.

Now, all that is left is to add %QTDIR%/bin to PATH and to try the Qt demos. However, keep on reading if you want to make the installation easier to use.

set PATH=%PATH%;%QTDIR%\bin
Command Line Conveniences

To make it a bit easier to get up and running with Qt, we will create two batch files. First, qt-vars.bat, that initializes the environment variables as shown in this text (gather all the lines starting with set in a file). To make things fancy, you can create a short-cut to this file. Set it to run cmd /K qt-vars.bat to end up with an intialized command prompt - quite nice.

The second batch file that I mentioned before is make.bat. Make it run mingw32-make and place it somewhere in path. If you want to be able to use command line arguments, pass on a few %1 %2 %3 and so on to MinGW. This will allow you to type make -j4, instead of prefixing it with mingw32- every time. You can place this file either in Qt's bin directory, or with the MinGW executables.

Eclipse

Since the Windows command prompt leaves quite alot to wish for, I prefer trying something else for a change. It it possible to use cygwin or other shell replacements, but hey, we're in a graphica environment, so why no try to use something grapical such as Eclipse.

Qt integrates quite well with Eclipse. Start by downloading Eclipse for C/C++, or just the standard edition with and the C/C++ support module. Then download the Qt integration. Commercial license holders will find it in their personal download directory.

Once all the installers have been run, start Eclipse through the Qt Eclipse Integration item on the Windows start menu. Then select File - New - Project... and choose to create Qt application. This will prompt you to specify what Qt version to use in the dialog shown below. Simply point out the version you just built and you are ready to go.



The Qt integration works great - but sometimes you can get a feeling of nausea. For example, it is not clear from the start how to execute the result of your project. But, then you can always revert to the good old command line.


Labels:

2008-08-08

It has a GUI

In the past, I fiddled with fractals. To force my-self to get started in the right directions, I started from the "other end", i.e. fixing the boring details and such before starting working on the user interface.

Now, my wait is over. The user interface is here, or the basics of it. One can pick fractals through a factory (wait for the plug-ins) and look at fractals. The setting docks are there, but not live and the viewer is just a QLabel i a QScrollArea - not very fancy.


This must be the only general fractal explorer not supporting Julia nor Mandelbrot... :-)

Labels:

2008-08-03

Foundations of Qt Development re-printed

I was happy to learn that Springer has printed my book, Foundations of Qt Development. Their distribution rights seem to span parts of south east Asia and the middle east. For the rest of us, APress is the preferred source.

In addition to this, the Linux Learning Centre, has decided to use the book as a part of their Qt course. Kudos to Prashanth for making this happen.

Finally, as a side note, real life has recently been too hot to get any hacking done. We've seen about two weeks with 30dgC+ temperatures here, but now it finally rains and temperatures as more comfortable.