lohanf
Posts: 5
Joined: Sat Apr 04, 2015 9:21 am

How to compile a relatively new QtCreator (3.2.2)

Sat Apr 04, 2015 10:29 am

Hello,

I needed to have a QtCreator that supports cmake. The one that comes with the raspbian distribution is too old and does not support it, so I tried to figure out a way to get a newer QtCreator, without a huge effort. I succeeded in compiling and running QtCreator 3.3.2, which apparently is the latest QtCreator that can be compiled with Qt 4.8.x (available from the raspbian distribution). Downloading and compiling QtCreator out-of-the-box fails because Botan, one of the internal dependencies has been generated (pre-compiled) for Intel and as such does not compile for ARM. The solution is to generate it for ARM and replace the Botan sources that come with the QtCreator. So here are the instructions on how to do it, hopefully it will be useful to somebody:

1. Download QtCreator 3.2.2 (the latest version that can be built with Qt 4.8) sources from here:
http://download.qt.io/official_releases ... 3.2/3.2.2/
Unpack it (e.g. in Downloads folder)
2. Download the Botan library from here:
http://botan.randombit.net/download.html
(direct link: http://botan.randombit.net/releases/Botan-1.10.9.tgz )
Unpack it (e.g. in Downloads folder)
3. Install Qt 4.8 that comes with the Raspbian distribution:
> sudo apt-get install qt-sdk
This will also install an old QtCreator. We do not need to worry about it.
I am sure not all packages installed by this command are needed, but I was not interested in which, exactly are needed and which are not.
4. Go to Botan folder and run:
> ./configure.py --cpu=arm --gen-amalgamation
This will generate 2 files: botan_all.cpp and botan_all.h
5. Rename botan_all.cpp and botan_all.h to botan.cpp and botan.h
6. Open botan.cpp in some editor and change:
#include “botan_all.h”
to
#include “botan.h”
7. Copy (overwrite) both botan.cpp and botan.h to qt-creator-opensource-src-3.2.2/src/libs/3rdparty/botan/
8. Compile qtcreator by running (inside qt-creator-opensource-src-3.2.2):
> qmake -r
> make
(first I tried to be smart and run "make -j 4" but I run into memory problems. "make" is slow but safe)
9. Install qtcreator somewhere, e.g. in /usr/local:
> sudo make install INSTALL_ROOT=/usr/local
10. (optional) To change the GUI menu to launch the new qtCreator instead of the old one: edit the /usr/share/applications/qtcreator.desktop:
> sudo leafpad /usr/share/applications/qtcreator.desktop
and change:
Exec=qtcreator %F
to:
Exec=/usr/local/bin/qtcreator %F
Save.
Thats it :-).
Now you have your new qtcreator in /usr/local/bin and the old qtcreator in /usr/bin. You may want to uninstall the qtcreator package, but that will uninstall the menu entry as well.

User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

Re: How to compile a relatively new QtCreator (3.2.2)

Sun Apr 05, 2015 1:50 pm

Hello,

Can I take it from this that the default QtCreator (2.5.0) and the new QtCreator (3.2.2) will co-exist on the same system?
You instructions seem fairly straight forward. (Thanks)

Regards

lohanf
Posts: 5
Joined: Sat Apr 04, 2015 9:21 am

Re: How to compile a relatively new QtCreator (3.2.2)

Mon Apr 06, 2015 2:26 pm

Yes, they can coexist.

PocketLint
Posts: 2
Joined: Sat Mar 15, 2014 4:18 pm

Re: How to compile a relatively new QtCreator (3.2.2)

Mon Apr 06, 2015 8:48 pm

Thanks, that worked fine on my Pi2. Been trying to figure this one out for weeks. All I need now is to get it working with Qt5 and life will be good.

Return to “C/C++”