Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installation of Qt 4.8.7 in Ubuntu 18.04.1 LTS

I am trying to install Qt 4.8.7 from source (https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz) in a virtual machine running Ubuntu 18.04.1 LTS

0_1551842108100_Ubuntu Machine.PNG

So the commands I follow are:

mkdir Qt
cd Qt
wget https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
tar -xzf qt-everywhere-opensource-src-4.8.7.tar.gz
mv qt-everywhere-opensource-src-4.8.7 Qt-Source
cd Qt-Source
./configure

Then I choose the Open Source Edition, accept the terms of License. After that it displays:

Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Trolltech/Qt-4.8.7

So ...

make 

and I have the next error;

0_1551845738419_Capturaqt.PNG

Another thing is that in the process of running make, there are a lot of errors like these:

0_1551845788905_Capturaqt2.PNG

Could you help me? Please

like image 703
Dauph Avatar asked Dec 08 '25 19:12

Dauph


1 Answers

eyllanesc,

I faced the same problem as you a few days ago. And after many tries I did it.

First of all, you'll need to install another gcc and g++ version elder (I choose 4.8 version).

Follow the instructions in this another answer: GCC & C++ alternatives

And edit the file: mkspecs/linux-g++-64/qmake.conf

QMAKE_CFLAGS            = -std=gnu++98 -fpermissive
QMAKE_LFLAGS            = -std=gnu++98 -fpermissive
QMAKE_CXXFLAGS          = -std=gnu++98 -fpermissive

With these flags the compiler will use C++98 version. Like Bart_Vandewoestyne solution.

Then run:

./configure -opensource -nomake demos -nomake examples -nomake tests -debug-and-release -qt3support -no-openssl -no-webkit
make -jN
sudo make install

After the complete installation back the default gcc and g++ versions:

cd /usr/bin
sudo mv g++ g++-4.8_
sudo ln -s g++-7 g++
sudo mv gcc gcc-4.8_
sudo ln -s gcc-7 gcc

And test:

gcc --version
g++ --version

Now it's time to compile some code. But, before this we need to unchanged the modifications on our mkspec:

cd /usr/local/Trolltech/Qt-4.8.4/mkspecs/linux-g++-64/
nano qmake.conf

And comment the lines changed and back to the original configuration:

#QMAKE_CFLAGS           = -std=gnu++98 -fpermissive 
#QMAKE_LFLAGS           = -std=gnu++98 -fpermissive 
#QMAKE_CXXFLAGS         = -std=gnu++98 -fpermissive

QMAKE_CFLAGS            = -m64
QMAKE_LFLAGS            = -m64
QMAKE_CXXFLAGS          = -m64

Now your change you *.pro file adding or change these lines:

QMAKE_CXX = g++-7
QMAKE_CC  = gcc-7

Let me know if it works. For me everything it's fine.

like image 88
kadok Avatar answered Dec 11 '25 12:12

kadok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!