How to compile Qt and friends on Debian Squeeze

1) Debian installation

I downloaded the Debian-life dvd from the Debian website :
Link [live.debian.net] 6.0.1: 2011-03-24

Then I booted using the life-DVD. Debian detected all the necessary drivers for my graphics card.
Then I restarted and used the graphical install to install my new Linux box.
I used synaptic [nongnu.org] to update some packages.

2) This is what I did to install Qt:

(I used root privileges in console with : su )

I installed the latest Qt release Debian-package which will provide all the dependencies you need and settings to look into.
I looked into the qconfig.pro file in the mkspecs folder to check the configure options used to build the package on Debian.
You don’t need to install this package but it helped me to figure things out.

Get all dependencies for Qt :

  1. apt-get build-dep qt4-qmake

Get git:

  1. apt-get install git-core

Get Git clone:

  1. git clone git://gitorious.org/qt/qt.git
  2. cd qt

I preferred to install in my own directory == /home/USER :

Configure + make + install

  1. ./configure -prefix /home/USER/qtsdk
  2. -debug-and-release
  3. -accessibility
  4. -opengl  
  5. -qt-lib-jpeg
  6. -qt-lib-mng
  7. -qt-lib-png
  8. -qt-lib-tiff
  9. -system-freetype
  10. -system-zlib
  11. -nis
  12. -cups
  13. -iconv
  14. -glib
  15. -dbus
  16. -dbus-linked
  17. system‑nas‑sound
  18. -openssl
  19. -xshape
  20. -xsync
  21. -xrender
  22. -mitshm
  23. -fontconfig
  24. -xkb
  25. ‑multimedia
  26. -xmlpatterns
  27. -multimedia
  28. -audio-backend
  29. -svg -webkit
  30. -script
  31. -scripttools  
  32. -qt-sql‑psql
  33. -qt-sql‑mysql
  34. -qt-sql‑odbc  
  35.  
  36. make

I choose to install several database drivers (postgresql, mysql and odbc), which are not needed for everyone. SQLite [sqlite.org] is installed by default.

I needed to compile the examples and demos separately because I’ve chosen my own directory to install in:

  1. make install

Then I tested my installation and even qtdemo is up and running. Nice!!

Set the Environment Variables

In order to use Qt, some environment variables need to be extended. PATH – to locate qmake, moc and other Qt tools
This is done like this:
In .profile (if your shell is bash, ksh, zsh or sh), add the following lines:

  1. PATH=/home/USER/qtsdk/bin:$PATH
  2.  export PATH

test it with:

  1. which qmake

This should point to /home/USER/qtsdk/bin
Hint : not a “/” at the end like in PATH=/home/USER/qtsdk/bin:$PATH

That’s all. Qt is now installed.

3) But where is Qt Creator?

Gitorious tells me it’s a separate repository, so obviously I have to install it separately :

  1. git clone git://gitorious.org/qt-creator/qt-creator

It is recommended that you build Qt Creator not in the source directory, but in a
separate directory. To do that, use the following commands:
  1. mkdir $BUILD_DIRECTORY
  2. cd $BUILD_DIRECTORY
  3. qmake $SOURCE_DIRECTORY/qtcreator.pro
  4. make

Categories: