Debugging Qt app with Qt Creator: <no such value> - debugging

I'm using Qt Creator with Qt 5.1.1 in Ubuntu 12.04.
When I'm using the debugger to show content of any variable, the window always show "no such value" on every variable. Also on variables of type QString, int etc.
Is there a configuration problem on my Ubuntu?
Can anybody help me please?

It's been a year and a half ago, but the problem still remains actual for Ubuntu 12.04, Qt Creator 3.4.0 based on Qt 5.4.1.
As mentioned in Qt Creator Manual
Starting with version 3.1, Qt Creator requires the Python scripting extension. GDB builds without Python scripting are not supported anymore and will not work. The minimal supported version is GDB 7.5 using Python version 2.7, or 3.3, or newer.
I suppose that gdb --version gives you 7.4 (the last version of gdb for Ubuntu 12.04). That's why you have no such value issue.
1. Install a fresh gdb (7.8)
Remove the current gdb (to avoid conflicts with new one) and install development packet for python (to build gdb with Python scripting)
sudo apt-get remove gdb
sudo apt-get install python2.7-dev
Install gdb from the sources
wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.xz
tar -xf gdb-7.8.tar.xz
cd gdb-7.8/
./configure --prefix=/usr/local --with-python
make
sudo make install
Now gdb 7.8 is in /usr/local.
2. Update Qt Creator settings
Open menu Tools > Options ...
Select Build&Run, tab Debuggers
Click Add
Type Name you like, write Path: /usr/local/bin/gdb
In tab Kits change Debugger: with that you just created
Hope this help someone who still love Ubuntu 12.04 and Qt.

Related

Run or use GCC without install

Can I use GCC for e.g GCC4.0.3 without installation
In my macOS I have installed Clang xcode , and GCC from Homebrew
In my Linux they are installed as well
But I want to use GCC (Specially older version) besides most updated version
Like NVM that manage Node version and it lets you install many nodejs with different version on your system
I want to use GCC4 specially for science and compiling Old FORTRAN to make my Source codes run and see the results
In new OS both macOS and Linux when you install gcc it will install most updated and that is not useful for old fortran or old codes.
So In my solution i think its better to use gcc without install or even install gcc to custom directory folder and copy the codes in that directory and compile them but not to install as wide system and make incompatibility with default GCC and CLANG on system
Thanks in advance

How do i install xcode on my ubuntu machine?

I have Lenovo Ideapad310 laptop with Ubuntu OS. But for iOS development I want to install Xcode in my machine, so how can i install Xcode in my machine?
please anyone help me??
First: You can't install Xcode on Ubuntu it's restricted only for Mac OS.
Second: I assume you want Swift, which you can install it over terminal using this command
sudo apt-get install clang
If you installed the Swift toolchain on Linux to a directory other than the system root, you will need to run the following command, using the actual path of your Swift installation:
export PATH=/path/to/Swift/usr/bin:"${PATH}"
You can verify that you are running the expected version of Swift by entering the swift command and passing the --version flag:
swift --version
for IDE you might use Visual Studio Code and install Swift plugin.
Good Luck

Install GCC 5.X on Xcode 6

I need to use/integrate GCC 5.X (in my case 5.3, and it is already installed) on Xcode 6.2.
I've found a lot of outdated tutorials about GCC 4.X and Xcode 5 (or lower), but all of them are outdated and do not work anymore.
I've also found this tutorial, but I have not the 5.3.xcplugin file that the tuto recommend to copy.
I am still on Mac OS X Maverick, and I can install Xcode 7 if necessary.
Anybody would know how to do it?
MacPorts still has an installer for Mavericks. It will likely add /opt/local/bin:/opt/local/sbin to your $PATH in .profile, or whatever shell startup file you use, and leave a backup of the old file you can probably get rid of once you're satisfied.
I would suggest upgrading to the latest Xcode release - and to El Capitan unless you have some specific reason not to. AFAIK, if you can run Mavericks, you can run the latter. I will avoid any arguments about the merits of Brew vs. MacPorts here. There's plenty of documentation on the MacPorts pages.
Make sure the package database is up to date:
sudo port -v selfupdate`
Have a look at the existing gcc ports:
port list | grep gcc
note: you might as well install the stable gcc6 (6.1.0) package.
Install the package - this may also install dependency packages:
sudo port install gcc6 [-universal]
This may take a while, as it might need to build from source. For most packages, the -universal flag says that you don't care about 32-bit (IA32) builds, etc.
You can see various package versions with port select ... options, e.g.,
port select --list gcc
And enable the installed gcc:
sudo port select --set gcc mp-gcc6
You may need to rehash so the shell adds the new binaries to its search. Or just start a new shell. gcc -v should yield something like:
gcc version 6.1.0 (MacPorts gcc6 6.1.0_0)

How to make the "Locals and Expressions" debugging window operational with gcc 4.8?

I am using gcc 4.7 and gcc 4.8 together with QtCreator 2.7.1.
The problem is that when I use gcc 4.8, I am unable to see the values of my variables in the "Locals and Expressions" window in debug mode:
While gcc 4.7 works fine:
I have tried to repair this by playing with the QtCreator options, but to no avail.
I am not sure, if this has actually something to do with the compiler version, but the problem goes away once I rebuild with the older version.
The reason probably is that gcc 4.8 is using by default newer format for storing debugging information (http://gcc.gnu.org/gcc-4.8/changes.html). If you are using gdb version less than 7.5 (see gdb --version) you need to provide -gdwarf-3 argument for compiling with debug info using gcc 4.8.
The same symptom can result from having a debugger that is too new, instead of too old!
In this case it's not about the GDB version, it's about the version of Python which was embedded into it when it was built. Ubuntu 13.10 ships with a GDB that's built with embedded Python3 instead of Python2. Qt Creator (at the time of this writing) is not compatible with that.
You can check to see if you've got a Python2 GDB by running it from a terminal and typing:
(gdb) python print sys.version
If you get an invalid syntax error, you've probably got Python3. That requires parentheses around what to print, so try:
(gdb) python print(sys.version)
When that comes back with a 3.x.x answer, Qt Creator's Python debugging scripts won't work (yet). So you'll need to get a GDB with Python2.
Here's my blog entry about it: QtCreator Debugger Not Showing Locals in Ubuntu 13.10.
In my case, it was what HostileFork described: ubuntu 13.10 + Qt Creator 2.8
This bug has been fixed in Qt Creator 3, not yet released.
To solve this without recompiling GDB, just use the release candidate of Qt Creator 3.
There are builds available on Qt project website or a PPA (ppa:p12/qtcreator) with last git version but build is broken as of today.

Remove Qt libraries on Mac

I want to remove the installed Qt 4.8 libraries and install Qt 4.6 libraries on my mac.
But when I try to install them I get:
"Qt libraries cannot be installed on this disk. A newer version of
this software already exists on this disk"
I removed the /usr/local/Qt4.8.x folder from the disk but the message is still here.
How can I remove the old libraries?
You shouldn't manually delete a folder unless there is no other option. You should try running the uninstall script first:
sudo python /Developer/Tools/uninstall-qt.py
The path to this script will be different if you are running the latest Xcode app bundle and not the default Snow Leopard/Lion Xcode.
I installed qt via homebrew. To remove I simply wrote the following in the terminal: brew uninstall qt#4

Resources