IMX6 QT-X11 support

From RidgeRun Developer Wiki

Introduction

In this Document you'll see the steps to compile Qt with X11 support in Ridgerun SDK. In the next section you'll see the steps to follow to enable it in Ridgerun SDK and finally you'll see a small description on how to configure Qt in order to compile it outside of Ridgerun SDK.

Compiling Qt with X11 support in Ridgerun SDK

The first step to successfully enable Qt with X11 support is to make sure that you have all the X libraries available in your SDK. Please follow the iMX6 Window Manager support guide to see how to do it.

Once you have all the necessary dependencies the next step is enabling Qt.

1. Go to File System Configuration -> Select target's file system software and select qt-4.8.5.

2. When you select it, you'll see that some other options are going to appear. Select Compile with X11 support in order to enable the usage of X11.

3. Select the additional features that you consider necessary (dbus, glib, examples, ...).

4. Exit and save configuration.

5. Compile your SDK.

make

After this, you'll have Qt working in a Windowed environment.

in the next section you'll see a short description on how to configure Qt to use X.

Compiling Qt with X11 support outside of Ridgerun SDK

In order to compile Qt for any platform two aspects have to be taken into account: proper configuration in the makefile and a proper configuration in the qmake.conf file. To see all the available configuration options for the makefile go to the Qt source folder and type:

./configure --help


That command is going to show you all the possible configurations that Qt is going to accept, basically, what features do you want to be compiled. If you see carefully at the output of that command, you'll see that some of the features are marked with a (*), that means that they are going to be included unless you explicitly disable them. You'll also see some of the features marked with a (+), those features are going to be evaluated by default, and if the necessary headers are present in the configured paths they are going to be included unless you disable them.

Depending on the features you are enabling you have to take care of the necessary dependencies. In order to enable Qt to use the X11 protocol, you have to enable the following features (among others).

  • XShape support
  • XVideo support
  • XSync support
  • Xinerama support
  • Xcursor support
  • Xfixes support
  • Xrandr support
  • Xrender support
  • Xi support

In order to successfully enable all of this features, all the necessary X*.h headers needs to be present in the appropriate path. Qt is automatically going to search for them and if they are not present, the feature is going to be disabled.

You also have to specify the "-no-embedded" option to tell Qt we are going to build for an X environment instead of an embedded one.

The other important file to consider is the qmake.conf. This file is where you configure all the Qt internal variables, paths and other options. If the X (or whatever) libraries are located in a none standard path make sure to specify the correct one in the appropriate variable. In the case of X11, the main variables are:

  • QMAKE_INCDIR_X11 = ___DEVDIR___/fs/fsdev/usr/include/X11
  • QMAKE_LIBDIR_X11 = ___DEVDIR___/fs/fsdev/usr/lib/X11
  • QMAKE_LIBS_X11 = -lXext -lX11 -lm -lXrandr
  • QMAKE_LIBS_X11SM = -lSM -lICE


In the next links you can find the complete makefile and qmake.conf used to enable QT/X11 support in the iMX6 board: