(Note: The problem indicated in this post is reported fixed by commentator James in Qt Creator 3.0 beta, although Antonello claims it’s actually only fixed in 3.0 RC1. I haven’t tried either yet… but if more reports come in saying that fixes the problem then that may be better than the workaround described for many users.)
Every now and again I build a new Qt development virtual machine, to try the “bleeding edge”. This weekend I tried moving some Qt 4.8 projects to Qt 5.1. And I decided to do this under a new Kubuntu 13.10 installation, with QtCreator 2.8.1.
It got started pretty painlessly. I bumped around and visited several blogs where people had gone through similar steps. There were some hassles with updating the CMake files (which I consider on par with voodoo), and a few reasonably well-documented changes that needed to be made the source code.
But the problem that took down pretty much a whole day of investigation turned out to be an interaction between the gdb that ships with Ubuntu 13.10 not playing well with Qt Creator. The result was that no variables could be inspected or viewed in the debugger (a clearly untenable situation). The appearance was similar to this StackOverflow question:
But that person’s problem was running an outdated version of GDB, while mine was the latest. It turns out the problem can also occur if your GDB is too new… for instance, compiled against Python3 instead of Python2. :-/
Assuming your GDB is built with any Python abilities at all, you can check the version by running gdb and then at the prompt:
(gdb) python print sys.version
If that gives you an “invalid syntax” error, it’s because Python3 requires parentheses around the print. So try doing:
(gdb) python print(sys.version)
If you get a 3.x.x back from that, then you’re living proof that what the Qt docs say about supported gdb versions is no longer true:
“The minimal supported version in this case is FSF GDB 7.4.1, using Python version 2.6 or 2.7. Note that Python 3.x is not supported by GDB.” [wrong]
What *is* true is that at this time of writing, the QtCreator dumper scripts won’t run under Python3. Someone recently reported this to Ubuntu, and submitted a bug report to Qt along with some preliminary steps to adapt the dumpers.
At this time it looks like getting a version of GDB built against Python2 and using that instead is the easiest thing to do. Here’s how… (and thanks to all the comments I’ve received, although integrating and testing them has made this into a bit more time than I wanted to spend! But glad people are finding it useful…)