Qt 5.1.0 on Ubuntu 12.04 LTS

Here are instructions to running Qt 5.1.0 on Ubuntu 12.04 LTS. Please note that I got it working on a virtual machine, here are the details:

  • VMware Player 5.0.2 build-1031769
  • New install of Ubuntu using image “ubuntu-12.04.2-desktop-amd64.iso”

Step 1
Get Ubuntu running on the VM, I’m not going go through all that. Once Ubuntu is ready, install the OpenGL development libraries:

sudo apt-get install libgl1-mesa-swx11-dev (see update below)
sudo apt-get install libgl1-mesa-dev

NOTE: I used the mesa libraries because I didn’t have the drivers for my graphics card.

Step 2
Download Qt from their website. I used this “qt-linux-opensource-5.1.0-x86_64-offline.run”.

Step 3
Install Qt:

chmod a+x qt-linux-opensource-5.1.0-x86_64-offline.run
sudo ./qt-linux-opensource-5.1.0-x86_64-offline.run

NOTE: I installed using sudo so that I can install to /opt/ so that everyone has access. For some reason when I installed it to /opt/, the examples directory has no permissions at all. I don’t know why it does that but here’s how you fix it:

sudo chmod -R a+rwx /opt/Qt5.1.0/5.1.0/gcc_64/examples

Step 4
Now you can run the examples. Run the examples from their original directory (in my case it is /opt/Qt5.1.0/5.1.0/gcc_64/examples) because some of the examples have code in folders outside their source folder.

I have tried the following examples and they work:

  1. Analog Clock
  2. Application
  3. Calqlatr*
  4. OpenGL Window*
  5. Same Game*

* Hang on, hang on! I’ll explain in the next section 🙂 See update below.

Yay! I finally got the OpenGL applications working (I’ve struggling for a day to get it working, it turned out i was using the wrong OpenGL mesa libraries). However, it appears that the color black is displayed transparently. WTF you ask?? Don’t look at me 😛

Does anyone know WTF is going here??

Problem fixed!! Yay!!

Use the “libgl1-mesa-dev” package and all is ok. This is because Ubuntu by default installed “libgl1-mesa-dri-lts-quantal” and the matching dev package is “libgl1-mesa-dev” (see http://packages.ubuntu.com/precise/libdevel/).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s