Page 1 of 1

Python QT (4 or 5)

Posted: Tue Oct 02, 2012 8:48 pm
by stevo_300

I have no real idea what I'm doing really.

I have had an idea to try and create a new desktop environment for myself. The idea I had was a Python/Qt foundation and just build from there. Unfortunately I just don't know where to start.

I have the latest Raspbian distro, a "which qt" reveals nothing and after looking through the app list using aptitude I wasn't sure what to install. I have found that people have compiled qt5 from source but I don't know how to do this.

I do know some Python and have a basic understanding of GUI programming from using VB.NET in visual studio.

If anyone can point me to a good starting point and possibly a few good simple examples I would greatly appreciate it.

Thanks Steve

Re: Python QT (4 or 5)

Posted: Tue Oct 02, 2012 9:09 pm
by toxibunny
Qt 5 on the Raspberry Pi (BCM2835)

Installing Qt 5 nightlies from the repo
We are generating Qt 5 nightlies for the Raspberry PI reference Raspbian image, and these are available here:

this is not currently shipped as part of the Raspbian reference image, and hence

you have to add:

deb unstable main

to your source list and then you need to do to get piping hot Qt 5 action in your life is:

apt-get update
apt-get install qt50-snapshot
help at all?

I found it while googling, it seemed like it would be easy enough to miss... I must admit though, I tried to get python and Qt working together on my windows box a while ago, and gigabytes of downloads and tutorials later I was just as clueless...

Knowing Qt does seem like it'd be a good skill to have in terms of possible paid employment though.

Re: Python QT (4 or 5)

Posted: Tue Oct 02, 2012 10:07 pm
by stevo_300
I found that and tried it too but couldn't get it working

Re: Python QT (4 or 5)

Posted: Wed Oct 03, 2012 12:38 am
by toxibunny
Haven't a clue then, sorry.

Re: Python QT (4 or 5)

Posted: Wed Oct 03, 2012 12:58 am
by DuncanKennedy

Take a look at the instructions here These instructions will walk you through setting up a cross compiler environment, compiling Qt5 base and other modules, then installing it yourself. The bakeqtpi.bash file is very helpful!

Once you have Qt5 built and installed, try building some of the sample programs provided in the Qt5 source.

Once installed on your Pi, don't forget to export LD_LIBRARY_PATH to point to the directory that Qt5 is installed in - if you follow the instructions, this will be /usr/local/qt5pi - without this export your programs won't be able to find your Qt5 resources when you try to run them.

By the way, the daily build of Qt5 that were mentioned earlier are no longer being maintained, so you are better off trying to compile your own first

Good luck

Re: Python QT (4 or 5)

Posted: Wed Oct 03, 2012 1:06 am
by DuncanKennedy
Also meant to add that you should check out the QTonPi mailing list as well Great place to ask questions since everyone there is just starting to face the same issues of getting Qt5 running on the Pi, but there is a lot of general Qt experience as well.

Re: Python QT (4 or 5)

Posted: Wed Oct 03, 2012 1:03 pm
by stevo_300
Thanks Duncan,

I have started going through the process, but have hit a stumbling block on the line:

./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/home/pi/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-relocations -reduce-exports -release -make libs -prefix /usr/local/qt5pi

I get the error

/home/pi/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++: 1: /home/pi/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++: Syntax error: "(" unexpected
-reduce-exports was requested but this compiler does not support it
Re-run configure with -v for more information

is there a dependancy i am missing?

Re: Python QT (4 or 5)

Posted: Fri Oct 05, 2012 1:57 pm
by DuncanKennedy
I've seen that error a couple of times. You can safely remove that flag from the configure statement. There is another similar one it will complain about as well, but you can remove that without impacting the results.

Re: Python QT (4 or 5)

Posted: Fri Oct 05, 2012 1:58 pm
by DuncanKennedy
Also, make sure you're running this in a 32 bit environment - it can be made to work in a 64 bit setup, but it's more complicated to do.

Re: Python QT (4 or 5)

Posted: Fri Oct 05, 2012 2:00 pm
by stevo_300

I think I have gotten around the problem. I am doing this on a VM linux mint 32bit box and is doing that stage right now. Before I was doing it actually on the pi

Re: Python QT (4 or 5)

Posted: Fri Oct 05, 2012 7:09 pm
by BlackJack
@stevo_300: Why don't you just install the Qt bindings for Python that are available as packages in the Linux distribution you are using?

Re: Python QT (4 or 5)

Posted: Sun Oct 07, 2012 7:48 pm
by stevo_300
i would like to develop on the Pi, also I don't yet have a physical linux box which isn't ideal for development.

I will keep plugging away and see how things get on

Re: Python QT (4 or 5)

Posted: Tue Oct 16, 2012 3:49 am
by PhilThompson
Just to keep people up to date...

I'm just about to start the process of porting PyQt4 to the Pi. It already runs under Qt5 built for X11 but I want to produce binary packages built against a non-X11 Qt5.

I anticipate that this will take a couple of weeks.