QtCreator on Linux Mint 18.3

After upgrading my Linux Mint installation to the current 18.3 (Sylvia) release I also wanted to check if QtCreator still works. I took the offline installer from

https://n9.dy.fi/2015/08/install-qtsdk-1-2-1-with-the-offline-installer/

and run it as before on Linux Mint 17.1:

https://n9.dy.fi/2015/01/qtcreator-on-rebecca/

Let’s use /opt/QtSDK as the installation directory.

During the installation I got one error message:

However, I could run the harmattan-postinstall.sh from the command line without errors so I just selected Ignore and the installation finished successfully.

When the installer is run with sudo some folders are created under $HOME/.config and $HOME/.local that are owned by root and will generate “permission denied” errors. So before invoking QtCreator the ownership should be fixed..

$ sudo chown -R $USER:$USER $HOME/.config $HOME/.local

There are some libraries that rely on libjpeg62 that is not available by default. So let’s install the required version.

$ sudo apt-get install libjpeg62

The xterm terminal is needed to run console applications:

$ sudo apt-get install xterm

Another issue is that the help contents are missing. If I select Tools>Options>Help>Documentation I will get an empty list:

However, all the help files (.pch) are in the installation folder (/opt/QtSdk/Documentation in my case) so I can add them by clicking the Add… button.

Now if I select Help>Contents I can browse the documentation.

The last issue I encountered was in the debugger. The debugger couldn’t display Qt variable contents (e.g. QString value). QtCreator is relying on gdb python bindings to display the variable values. The gdb that is bundled with Linux Mint 18.3 (gdb version 7.11.1) is compiled with python3 support but QtCreator only supports python v2. You can check the python version with the commands:

$ gdb
(gdb) python print(sys.version)

I solved this issue simply by fetching the gdb sources and recompiling. The source code repositories can be enabled by selecting “Software Sources” from the Administration menu and then checking “Enable source code repositories”. I will install gdb under /opt/gdb.

$ sudo apt install ncurses-dev python-dev
$ sudo apt install dpkg-dev texinfo
$ cd $HOME/Work/Source/Gdb
$ apt source gdb
$ export MAKEINFO=makeinfo
$ cd gdb-7.11.1/
$ ./configure -with-separate-debug-dir=/usr/lib/debug --prefix=/opt/gdb
$ make -j 4
$ sudo make install

As a final step I will replace the original gdb with a symbolic link to the new one.

# mv /usr/bin/gdb /usr/bin/gdb.orig
# ln -s /opt/gdb/bin/gdb /usr/bin/gdb

After this the gdb should show python v2.

$ gdb
(gdb) python print sys.version
2.7.12 (default, Dec  4 2017, 14:50:18)

One additional change will be required to allow access to ptrace.

# echo 0 > /proc/sys/kernel/yama/ptrace_scope
# vi /etc/sysctl.d/10-ptrace.conf

Edit /etc/sysctl.d/10-ptrace.conf and set kernel.yama.ptrace_scope = 0.

Now the debugger should work as before.

If you need git support in QtCreator you should install version 1.8.3 (by default v2.7.4 will be installed). You can download the source code package (git-1.8.3.4.tar.xz) from https://mirrors.edge.kernel.org/pub/software/scm/git/.

$ sudo apt remove git
$ sudo apt install libcurl4-openssl-dev
$ sudo apt install zlib1g-dev asciidoc xmlto
$ cd $HOME/Work/Source/Git
$ ./configure --prefix=/opt
$ make -j4 all doc
$ sudo make install install-doc

You may also want to edit /etc/environment to add the installation folder (e.g. /opt/bin) to the default path.

It is also possible to compile and run console applications without the QtCreator IDE by setting up qtchooser. Just create a configuration file $HOME/.config/qtchooser/default.conf with the contents:

/opt/QtSDK/Desktop/Qt/4.8.1/gcc/bin
/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *