svn - wrong version for Qt Creator on OS x - c++

In my code I need to display the svn version of my project...
The project was created in Windows and uses svn version 1.8.10
On OS X 910.9) the installed version for svn was 1.7.9 so I had to upgrade it.
I got 1.8.10, and checking from the terminal, it shows that.
I added the installed directory for svn to the path. The "set" command now shows
PATH=/opt/subversion/bin:/usr/bin:....
But.... From Qt Creator, I am still unable to use svn:
svn: E155021: This client is too old to work with he working copy at '/path_to_project_folder' (format 31).
You need to get a newer Subversion client. For more details, see http://subversion.apache.org/faq.html#working-copy-format-change
The command '/usr/bin/svn' terminated with exit code 1.
So... it seems that Qt Creator (and the command I call from the project file) uses the old path for svn...
The work-around for now is to hard-code the full path to svn in the pro file (the command that gets the version)
But... How can I get Qt to work with the correct svn version without having to hard-code the path in program ?

I found the Environment section in Qt Creator - which uses its own PATH... doesn't seem to get updated with updates on system PATH but I was able to add to it manually

Related

Ubuntu 14.04 - Qt version choosing

I mistakenly updated my qt version from 4.8.5 to 4.8.6. This happened as a result of python anaconda installation.
However I am working on a project that needs qt 4.8.5.
Running qmake -v shows:
$ qmake -v
QMake version 2.01a
Using Qt version 4.8.6 in home/<username>/anaconda/lib
How do I switch to my previous qt version (installed in the default directory, i.e. /usr/... )?
qtchooser lists the following options:
$ qtchooser -list-versions
4
5
default
qt4-i386-linux-gnu
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5
But trying export QT_SELECT with every option didn't change the message:
Using Qt version 4.8.6 in home/<username>/anaconda/lib
I will greatly appreciate your help.
You can easily use several versions of Qt. All you need to do is - call qmake, that comes with the needed version. For example:
/usr/local/Trolltech/Qt-4.8.5/bin/qmake -v
When using QtCreator, you can add Qt version in Tools/Options.../Build & Run and switch between Qt versions in project's settings (some versions on QtCreator will require creating a Kit also, which is not very hard).
The only problem I faced is - using cmake (hate this piece of garbage). In this case you'll need to change the order in which qmake of different versions are called. First of all, find out where your default qmake is located (which qmake), then - whether it is a symlink or not (it is strange, that Qt, installed in your home directory is called without using full path). If it is a link, then change it from one Qt's version to another. If not - examine echo $PATH. What you can do: you can create a symlink for Qt4.8.5's qmake to a directory, which is previous to one, in which Qt4.8.6's qmake is. Or you can add path to it in your $PATH in the first position (sudo nano /etc/environment. Important - in some OS /etc/environment will be empty. In this case you need to write whole $PATH there, like echo PATH=\"/usr/local/Trolltech/Qt-4.8.5/bin:$PATH\" > /etc/environment).

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

Stepping into Qt sources in Qt Creator (in Ubuntu Linux)

I'm using Qt Creator in Ubuntu. It's installed from the repositories but as it is now, there is no way to step into the Qt sources when debugging.
How can I enable that?
Since Qt Creator uses gdb, you need to configure gdb. First thing to do is to install Qt debugging symbols:
apt-get install libqt4-dbg
Or, for Qt5:
apt-get install qtbase5-dbg # For the qtbase package
This will install the debugging symbols for Qt libraries. Older releases of Ubuntu had a silly bug that required additional trick to correct those symbol files, but in the current release it works fine.
This will make gdb step inside Qt methods, but it's no fun without sources. So we need sources which can be installed like this, assuming that the source repository is enabled in the APT:
apt-get source qt4-x11
ln -s qt4-x11-4.7.0 qt # a convenience symlink
Or, for Qt5:
apt-get source qtbase-opensource-src
# Make a link as above, if you wish
This will download the sources, unpack them into the current directory and patch them accordingly, no root privileges needed unless the current dir isn't writeable by the current user.
And the last thing is to inform gdb of the sources location, which is done by putting this in the ~/.gdbinit file:
dir ~/vita/qt/src/corelib
dir ~/vita/qt/src/gui
dir ~/vita/qt/src/network
dir ~/vita/qt/src/sql
Add modules and correct paths as needed. The convenience symlink is very useful here, so we don't have to edit this file each time we upgrade to a new Qt version. We only need to download the new sources, patch them and change the symlink.
Note that even we have installed the debugging symbols, we still use the release build of Qt libraries. This means that the code is highly optimized and will sometimes behave very strange when stepping inside Qt binaries. If it is a problem, then it is necessary to build Qt in debug mode, install it separately (say, in /usr/local/qt4-debug) and tell Qt Creator to use that particular installation.
The only way i made it work on Ubuntu is building Qt from sources with configure -debug.
Everything started to work like a charm afterwards.
Qt binary packages for Linux don't contain debug symbols and therefore the debugger doesn't know files or line numbers where to jump to. You need to build Qt yourself with -debug configure option if you want to be able to debug Qt code.
Instructions from Sergey Tachenov instructions would only work if you build your application against the Qt version that you can find from Ubuntu repositories.

Qt on Linux - version conflict?

Trying to move a Qt 4.6.3 project from Windows to Debian Linux (Etch). I've installed Qt by downloading the latest version, then running configure, then make install as root. Yet when I run qmake_qt4 on my project's pri file, here's what I get:
uic: File generated with too old version of Qt Designer
Running uic -v returns 4.2.1. How come? Wasn't make install supposed to put the latest Qt on the system?
By default, Qt installs to /usr/local/Trolltech/Qt-4.6.3 and doesn't add it's bin folder to your PATH variable. Also, it's just named qmake.
Either call /usr/local/Trolltech/Qt-4.6.3/bin/qmake using the complete path or add the /usr/local/Trolltech/Qt-4.6.3/bin/ path to your PATH variable and ensure that it is listed there before any other path that may have a qmake. Best thing to do is to uninstall the the debian qt version if you don't need it elsewhere.

Using QtMobility in QtCreator: Setup?

I am trying to set up a development environment to play around with developing Qt apps for Symbian devices. I have succesfully set up the environment and am able to create simple apps such as HelloWorld and get them to run on my device. I would now like to try using the QtMobility package, but I am struggling to get it to work in QtCreator.
I got some sample code for using the camera (initially I only had QtMobility 1.0.2, but I have now downloaded the 1.1.0 technology preview version). I followed the instructions in the help file to install it, here is what I did:
Extracted the zip file to C:\QtMobility
Opened a Qt Command prompt and ran configure (in the QtMobility directory)
Ran mingw32-make
Ran mingw32-make install
Finally I updated my PATH variable to include C:\QtMobility\lib
I went back to QtCreator (restarted it) and looked at the cpp file that first calls the macro QTM_USE_NAMESPACE but it is still underlined in red, because it can't find the qmobilityglobal.h file.
Does anyone know if I have missed anything out during the installation that will tell the QtCreator where to find the QtMobility header files?
mingw32-make suggests you're building for win32-mingw target environment. To work with Symbian SDKs, you should be building for e.g. symbian-abld instead. The configure.bat script will auto-detect the target you are building for. Just make sure that QT_PATH environment variable points to a location where you have a Symbian build of the Qt toolchain.
(Also note that make install is unnecessary with symbian-abld - the build step already puts everything in place in Symbian SDK directories.)