M
M
megomark2014-02-18 17:47:50
Qt
megomark, 2014-02-18 17:47:50

How to build Qt 4.8.5 from source for Linux?

I wanted to build an old project under qt 4.8.5 for linux. But I can’t do it (I’ll explain what the problem is later). I would like to make a detailed instruction on how to do this - maybe not only me it will come in handy.
Installed system: Linux Mint 16 KDE x32.
Installed packages: build-essential
Also installed the SDK: Qt 5.2.1 for Linux 32bit
So I downloaded the qt 4.8.5 sources for Linux from the site .
I unpacked them using the Ark archiver.
Found a description of how to do it .
It describes 2 ways how to do it:
1) install to /usr
2) install to /opt/qt-4.8.5
The 2nd way is more suitable for me so that several different versions of qt can be installed on the computer.
First, I installed the necessary dependencies for building qt using the command in the terminal.

sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libxcursor-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev

Then I ran the following code in the terminal:
sed -i -e "/#if/d" -e "/#error/d" -e "/#endif/d" \
     config.tests/unix/libmng/libmng.cpp &&
sed -i '/CONFIG -/ a\isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../..' \
     src/3rdparty/webkit/Source/WebKit2/DerivedSources.pro &&

export QTDIR=/opt/qt-4.8.5

Then ran the command
./configure -prefix     $QTDIR               -sysconfdir /etc/xdg             -confirm-license                 -opensource                      -release                             -nomake demos                    -nomake examples    -no-webkit

make
sudo make install
In QtCreator-e in the menu "Tools-> Options-> Build and Run-> Qt Profiles" I add a new profile. To do this, I find qmake in the /opt/qt-4.8.5/bin folder and press the "Open" button. And I name the profile "Qt 4.8.5".
After in the menu "Tools->Options->Build and Run->Kits" I add the profile "Qt.4.8.5".
I start the project in QtCreatore 3.0.1. and set up on the side on Qt 4.8.5.
The build works fine, but when I run the application, I get an error message:
Cannot mix incompatible Qt library (version 0x40804) with this library (version 0x40805).
I understand that the versions of Qt are different - the system uses Qt 4.08.04 and I have compiled the program under Qt 4.08.05. But how to solve this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EXL, 2014-02-18
@EXL

I faced the same problem . You can read the article on the link above, there is a very detailed instruction for building Qt 4.8.5
In short, the problem is that your desktop environment (KDE) uses Qt 4.8.4, and accordingly there is a conflict between the libraries. You can solve it like this:
1. Install the dbus-dev package:
2. Configure Qt with something like this command:
3. Rebuild.
If you need backend support for GStreamer (to work with audio / video) - do not forget to specify -glib -phonon -phonon-backendand install the necessary headers when configuring.

M
megomark, 2014-02-18
@megomark

Thank you! I'll try it tomorrow at work and share the results. I also liked the link - you can learn a lot of interesting things.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question