Cristian Adam

Qt Creator, Ubuntu, and VirtualBox

It is common for IT companies (at least in Germany, automotive field) to use Ubuntu Linux LTS in a VirtualBox on Windows or Mac hosts. This way the employee can use Microsoft Outlook / Office, Microsoft Skype, Cisco Spark, or other proprietary collaboration tools, and at the same time use the supplied virtual machine for development.

By default VirtualBox doesn’t configure any 3D acceleration or multi-core CPU for the guest. One needs to change these settings in order to have a more responsive desktop environment and to compile faster smile Also important not to forget about the installation of the VirtualBox Guest Additions.

Running glxinfo on a Ubuntu Linux 16.04 LTS in VirtualBox 5.1.18 gives back this information:

OpenGL vendor string: Humper
OpenGL renderer string: Chromium
OpenGL version string: 2.1 Chromium 1.9
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler

As it turns out this is not enough to run Qt Creator 4.2.1. Qt Creator simply displays a black welcome screen on Ubuntu Linux 16.04 LTS, or simply crash on Ubuntu 14.04 / 12.04 LTS:

If Qt Creator is run from command line, it will give out these messages (Ubuntu 16.04 LTS):

QOpenGLFramebufferObject: Unsupported framebuffer format.
QOpenGLFramebufferObject: Unsupported framebuffer format.

If you do a web search after “Qt Creator VirtualBox crash” you will find out how to fix this problem – either disabling the welcome plug-in, or disable the 3D acceleration of your VirtualBox.

Disabling the 3D acceleration means that the system will use a software OpenGL driver.

But then again why not simply use a software OpenGL driver just for Qt Creator and not for the whole system?

Qt Creator ships on Windows with a software OpenGL driver you can find it under Qt Creator’s bin directory and it’s named opengl32sw.dll. If you rename the file to opengl32.dll you will force Qt Creator to use the software OpenGL driver.

What about Linux? Unfortunately Qt Creator doesn’t ship the equivalent OpenGL driver, so you will have to build it yourself, or download the precompiled binaries that I will provide at the end of the article.

If you look at Mesa 3D’s llvmpipe page you will see how easy it is to build the software driver:

  • Install the prerequisites sudo apt install g++ scons llvm-dev
  • Get the source code wget
  • And compile with scons build=release libgl-xlib

This is true if you have all the prerequisites! If you don’t have them, then it’s a process of compile, break on error, install missing package, and then try again.

After a few attempts I’ve managed to have this build script:


sudo apt-get install g++
sudo apt-get install llvm-dev
#for ubuntu 12.04
#sudo apt-get install llvm-3.4-dev
#sudo sudo ln -s /usr/bin/llvm-config-3.4 /usr/bin/llvm-config
sudo apt-get install scons
sudo apt-get install x11-xcb-dev
sudo apt-get install libx11-dev
sudo apt-get install libx11-xcb-dev
sudo apt-get install libxcb-xfixes-dev
sudo apt-get install libxcb-xfixes
sudo apt-get install libxfixes-dev
sudo apt-get install libxcb1-dev
sudo apt-get install libxext-dev
sudo apt-get install libxi-dev
sudo apt-get install libxrender-dev
sudo apt-get install libxcb-glx0-dev
sudo apt-get install libxdamage-dev
sudo apt-get install libxcb-glx-dev
sudo apt-get install libxcb-dri2-0-dev 
sudo apt-get install x11proto-gl-dev 
sudo apt-get install python-pip
sudo pip install Mako
sudo apt-get install flex
sudo apt-get install bison
sudo apt-get install zlib1g-dev

tar xJf mesa-17.0.2.tar.xz
cd mesa-17.0.2/

scons build=release libgl-xlib -j 3

cd build/linux-x86_64/gallium/targets/libgl-xlib/
cp ~/qtcreator-4.2.1/lib/qtcreator/

Precompiled binaries

Simply unpack with tar xJf ubuntu...tar.gz -C ~/qtcreator-4.2.1/lib/qtcreator/ and Qt Creator should pick the software OpenGL driver on the next start.

Ubuntu 12.04

Ubuntu 12.04 is a bit dated and it requires a few workarounds in order to run Qt Creator 4.2.1

If you get the following error:

./qtcreator: symbol lookup error: /home/cristian/qtcreator-4.2.1/lib/Qt/plugins/platformthemes/ undefined symbol: g_type_ensure

Simply delete the file. Qt Creator will then start.

The next runtime error will be, displayed as the reason for not being able to load many plugins:

"/usr/lib/x86_64-linux-gnu/ version `GLIBCXX_3.4.18' not found"

Which gets fixed by installing the following ppa and a reboot for good measure:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libstdc++6-4.7-dev

Software OpenGL Driver

You can use the Software OpenGL driver for other x86_64 programs, not only Qt Creator smile