It seems upgrading to Ubuntu 13.04 breaks a few things in the QGIS build process. Here’s some quick workarounds I’ve found to get it building again.
Firstly, Ubuntu defaults to Qt 5, causing the error:
CMake Error at /usr/share/cmake-2.8/Modules/FindQt4.cmake:1216 (message):
Found unsuitable Qt version "5.0.1" from /usr/bin/qmake, this code requires Qt 4.x
This can be fixed by switching the system default back to Qt 4, so that qmake refers to the Qt 4 version. The “qt4-default” package handles this switch for you, so just run:
sudo apt-get install qt4-default
Update: A better solution was found by Pierre and Pvanb and is described here. Basically it involves changing the QMAKE_EXECUTABLE option from /usr/bin/qmake to /usr/bin/qmake-qt4.
Next, I was getting the error:
make[2]: *** No rule to make target `/usr/lib/libpython2.7.so', needed by `output/lib/libqgispython.so.1.9.0'. Stop.
I’m not sure if this is the correct solution, but setting up some links and re-running ldconfig gets around this:
sudo ln -sf /usr/lib/x86_64-linux-gnu/libpython2.7.so.1 /usr/lib/libpython2.7.so.1 sudo ln -sf /usr/lib/x86_64-linux-gnu/libpython2.7.so /usr/lib/libpython2.7.so sudo ldconfig
Update: a better solution is to change the PYTHON_LIBRARY option from /usr/lib/libpython2.7.so to /usr/lib/x86_64-linux-gnu/libpython2.7.so for 64 bit environments, or /usr/lib/libpython2.7.so to /usr/lib/i386-linux-gnu/libpython2.7.so for 32 bit environments
These two changes were enough to get QGIS building again. If you’ve got a better solution for these errors, let me know…
I do not think making system-wide changes to compile a single piece of software is a good idea. You should be able to solve both issues with flags during the configuration phase.
For example, in Archlinux I use this command to configure the build: cmake ../Quantum-GIS -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_SITE_PACKAGES_DIR=/usr/lib/python2.7/site-packages -DPYTHON_INCLUDE_PATH=/usr/include/python2.7 -DQT_INCLUDE_DIR=/usr/include/qt4
Yeah, I probably should revise this. Build environments aren’t my strong point, but I needed a quick way to get qgis compiling again. I’ll do some more experimenting and see if some variation of your flags works for 13.04.
Ok, thanks for the pointer. I’ve revised this post to reflect better solutions based on your advise.
[…] compile properly. Not as it turned out, but the solutions were easy and quick, thanks to posts on nyalldawson.net and […]