Monday, December 28, 2009

Starting Up Qt Development

I created this blog to document my pursuit on Nokia's Qt Mobility Contest.

I use Ubuntu Karmic Koala 9.10, which contains Qt Creator 1.2 and Qt 4.5. I want to use the new Qt Creator 1.3 and Qt 4.6.

This is what Qt Creator 1.3 looks like for you curious people:


From Kev's Qt Mobility Development

Before jumping on to Qt Mobility and (then) Qt for Symbian, first I need to get started with Qt.
  1. Download Qt Development Environment (Qt Creator and Platform SDK)
  2. Install Qt Creator 1.3. This part was easy, simply chmod +x (add executable permission) to Qt Creator 1.3 installer and run it. It launches GUI Installer which was fast and smooth.
  3. Install Qt 4.6. Unfortunately, Nokia/TrollTech didn't provide Qt binaries for Linux systems.
  4. Configure Qt Creator with Qt 4.6. (and rebuild the debugging helper.) This one is easy, see below.

Installing Qt 4.6 from Sources
  1. Install checkinstall package. This will help you uninstall Qt 4.6 easily.
  2. Install dependencies:
    $ sudo apt-get build-dep libqt4-core
  3. Unpack the Qt 4.6 sources.
  4. Open a Terminal on the extracted folder.
  5. Run:
    $ ./configure
    By default, Qt will be installed at /usr/local/Trolltech. You may want to use the -prefix argument to specify another installation folder.
  6. Run:
    $ sudo checkinstall
    In case you can't/don't want to use checkinstall:
    $ sudo make install
  7. Be very patient.
    I've been running the make for about an hour now and it still hasn't finished. Time to take a nap.
    Update: Oh, it's finished in about 2.5 hours! Yaay!
Configure Qt Creator 1.3 with Qt 4.6


From Kev's Qt Mobility Development

  1. Launch Qt Creator.
  2. Go to Tools -> Options.
  3. Click "Qt versions".
  4. Click the Add button, then browse for your Qt 4.6 installation folder. Choose the bin/qmake binary.
    In my system, it is: /usr/local/Trolltech/Qt-4.6.0/bin/qmake
  5. Under Debugging Helper, click "Rebuild"
  6. Make sure you set it as Default Qt version
Now you should be able to create, run, and debug* Qt apps right away.

* GDB 7.0 Problems?

Qt says GDB 7.0 has issues with debugging. Unfortunately, Ubuntu 9.10 uses GDB 7.0:
$ gdb --version
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
For Qt development, downgrading to GDB 6.8 is recommended for now.

And sure enough, I can't debug my simple Hello World Qt console application with GDB 7.0 installed:
&"warning: GDB: Failed to set controlling terminal: Invalid argument\n"
/home/ceefour/Sandbox/helloworld-console/helloworld-console: symbol lookup error:
/usr/local/Trolltech/Qt-4.6.0/lib/libQtGui.so.4: undefined symbol: _ZNK17QVariantAnimation10metaObjectEv

No comments:

Post a Comment

Be the first to comment!