1

My Tool BoUML is based on Qt4 with Qt3 support, and I wanted to compile it under Debian Bookworm on my new Pi5.

For that I needed first to compile that old QT version from sources, and without surprise this is not possible because g++ indicates a lot of errors.

How to compile and install QT 4.8.7 then ?

1 Answer 1

1

Get the sources

First it is needed to get Qt 4.8.7 sources, a way to do is :

wget https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
tar xf qt-everywhere-opensource-src-4.8.7.tar.gz
cd qt-everywhere-opensource-src-4.8.7

Configure for Bookworm

The script part uses a lot of invalid forms since C++11, and I don't need it, so I configure QT without them :

./configure -no-script

However, the configuration choices are not only linked to the configure options, they also depend on what you have or have not installed elsewhere, as well as the version of your OS. In my case I am therefore on a Pi5 64b under the recommended OS Debian Bookworm, and the configuration displayed when executing configure -no-script is:

Build .................. libs tools examples demos docs translations
Configuration ..........  release largefile stl precompile_header  minimal-config small-config medium-config large-config full-config qt3support accessibility opengl shared reduce_exports ipv6 clock-gettime clock-monotonic mremap getaddrinfo ipv6ifname getifaddrs inotify system-jpeg system-png png system-tiff system-freetype system-zlib iconv glib dbus x11sm xshape xsync xrender mitshm fontconfig xkb icu concurrent multimedia audio-backend svg release
Debug .................. no
Qt 3 compatibility ..... yes
QtDBus module .......... yes (run-time)
QtConcurrent code ...... yes
QtGui module ........... yes
QtScript module ........ no
QtScriptTools module ... no
QtXmlPatterns module ... no
Phonon module .......... no
Multimedia module ...... auto
SVG module ............. yes
WebKit module .......... no
Declarative module ..... no
Support for S60 ........ no
Symbian DEF files ...... no
STL support ............ yes
PCH support ............ yes
MMX/3DNOW/SSE/SSE2/SSE3. no/no/no/no/no
SSSE3/SSE4.1/SSE4.2..... no/no/no
AVX..................... no
Graphics System ........ default
IPv6 support ........... yes
IPv6 ifname support .... yes
getaddrinfo support .... yes
getifaddrs support ..... yes
Accessibility .......... yes
NIS support ............ no
CUPS support ........... no
Iconv support .......... yes
Glib support ........... yes
GStreamer support ...... no
PulseAudio support ..... no
Large File support ..... yes
GIF support ............ plugin
TIFF support ........... plugin (system)
JPEG support ........... plugin (system)
PNG support ............ yes (system)
MNG support ............ plugin (qt)
zlib support ........... system
Session management ..... yes
OpenGL support ......... yes (Desktop OpenGL)
OpenVG support ......... no
NAS sound support ...... no
XShape support ......... yes
XVideo support ......... no
XSync support .......... yes
Xinerama support ....... runtime
Xcursor support ........ runtime
Xfixes support ......... runtime
Xrandr support ......... runtime
Xrender support ........ yes
Xi support ............. runtime
MIT-SHM support ........ yes
FontConfig support ..... yes
XKB Support ............ yes
immodule support ....... yes
GTK theme support ...... no
SQLite support ......... plugin (qt)
OpenSSL support ........ no 
Alsa support ........... no
ICD support ............ no
libICU support ......... yes
Use system proxies ..... no

When configure finished we have the sources and makefiles, the modifications can be made.

Modifications

Here are the modifications I made, trying to minimize them.

In qt-everywhere-opensource-src-4.8.7/src/dbus/Makefile and qt-everywhere-opensource-src-4.8.7/src/plugins/accessible/widgets/Makefile add the option -fpermissive into the definition of CXXFLAGS

In qt-everywhere-opensource-src-4.8.7/src/plugins/accessible/widgets/itemviews.cpp replace the line 396 being :

view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);

by

view()->selectionModel()->select(index, static_cast<QItemSelectionModel::SelectionFlags>(QItemSelectionModel::Columns & QItemSelectionModel::Deselect));

In qt-everywhere-opensource-src-4.8.7/tools/linguist/linguist/messagemodel.cpp line 186 add a cast for 0 to obtain :

if (c->findMessage(m->text(), m->comment()) >= ((MessageItem*)0))

In qt-everywhere-opensource-src-4.8.7/src/corelib/global/qglobal.h line 2500 it is needed to replace the break by a continue, and this is funny because this is link to a bug fixing into g++. Note that it is possible to simplify the definition of foreach and for instance brk is useless, but as I said I do the minimal changes. So the line is now :

for (variable = *_container_.i;; __extension__ ({--_container_.brk; continue;}))

Now it is possible to compile then install Qt :

make -j3
sudo make install

Qt 4.8.7 is then installed under /usr/local/Trolltech/Qt-4.8.7 without risk of interaction with a possible installation of Qt 5 or 6. You can remove the directory qt-everywhere-opensource-src-4.8.7

/usr/local/Trolltech/Qt-4.8.7/bin/qmake allows to produce the makefiles using Qt 4.8.7

Case of Debian Bullseye

I also compiled QT 4.8.7 on my Pi 4 under Debian Bullseye, the modifications are the same, but ssl is not configured to no by default and the compilations failed. To solve that I had to configure QT like that :

./configure -no-script -no-openssl

Out of that the modifications to do in sources and makefiles are exactly the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.