Difference between revisions of "How to Install Qt 5 and Qwt on CentOS 6"

From Qt Wiki
Jump to: navigation, search
(Put into category Install.)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
h1. Overview
+
[[Category:HowTo]]
 +
[[Category:Install]]
  
If you are trying to install Qt and "Qwt ":http://qwt.sourceforge.net/ (Qt Widgets for Technical Applications) on CentOS, then the following instructions should be of good use. These steps were created, after many a trial and error, using Qt 5.1.1 and Qwt 6.1.0 on CentOS 6.4 x86 64bit. These steps have proven to work on several CentOS machines and could also work on Fedora and Red Hat.
+
= Overview =
 +
If you are trying to install Qt and [http://qwt.sourceforge.net/ Qwt ] (Qt Widgets for Technical Applications) on CentOS, then the following instructions should be of good use. These steps were created, after many a trial and error, using Qt 5.1.1 and Qwt 6.1.0 on CentOS 6.4 x86 64bit. These steps have proven to work on several CentOS machines and could also work on Fedora and Red Hat.
  
 
Feel free to use newer versions of the install packages, but just make sure to alter the version numbers in the steps as applicable. Also, most dependencies are covered in these instructions, but there may be others that you will have to find if something fails to build properly.
 
Feel free to use newer versions of the install packages, but just make sure to alter the version numbers in the steps as applicable. Also, most dependencies are covered in these instructions, but there may be others that you will have to find if something fails to build properly.
Line 7: Line 9:
 
== Installing Qt 5.1.1 on CentOS 6.4 ==
 
== Installing Qt 5.1.1 on CentOS 6.4 ==
  
1. Install Development Tools<br /><code>sudo yum groupinstall &quot;Development Tools&amp;quot;<code>
+
1. Install Development Tools
 +
<code>sudo yum groupinstall "Development Tools"</code>
  
2. Install glibc-devel.i686 (the 32-bit version is required to build GCC)<br /></code>sudo yum install glibc-devel.i686</code>
+
2. Install glibc-devel.i686 (the 32-bit version is required to build GCC)
 +
<code>sudo yum install glibc-devel.i686</code>
  
3. Download and install &quot;GCC &quot;:http://gcc.gnu.org/ 4.8.1 or latest version. Instructions copied from &quot;here&amp;quot;:http://gcc.gnu.org/wiki/InstallingGCC<br /><code>tar xvjf gcc-4.8.1.tar.bz2<br />cd gcc-4.8.1<br />./contrib/download_prerequisites<br />cd ..<br />mkdir objdir<br />cd objdir<br />$PWD/../gcc-4.8.1/configure —prefix=$HOME/gcc-4.8.1<br />make<br />sudo make install</code>
+
3. Download and install [http://gcc.gnu.org/ GCC ] 4.8.1 or latest version. Instructions copied from [http://gcc.gnu.org/wiki/InstallingGCC here]
 +
<code>tar xvjf gcc-4.8.1.tar.bz2
 +
cd gcc-4.8.1
 +
./contrib/download_prerequisites
 +
cd ..
 +
mkdir objdir
 +
cd objdir
 +
$PWD/../gcc-4.8.1/configure —prefix=$HOME/gcc-4.8.1
 +
make
 +
sudo make install</code>
  
4. Copy new GCC libraries to /usr/lib64<br /><code>sudo mv /usr/lib64/libstdc+''.so.6 /usr/lib64/libstdc.so.6.backup<br />sudo cp -P /opt/gcc-4.8.1/lib64/libstdc.so.6 /usr/lib64<br />sudo cp /opt/gcc-4.8.1/lib64/libstdc.so.6.0.18 /usr/lib64/<br />sudo ldconfig -v</code>
+
4. Copy new GCC libraries to /usr/lib64
<br />5. Download and install &quot;Qt&amp;quot;:http://qt.io/ 5.1.1 or latest version<br /><code>sudo ./qt-linux-opensource-5.1.1-x86_64-offline.run<code>
+
<code>sudo mv /usr/lib64/libstdc+''.so.6 /usr/lib64/libstdc.so.6.backup
<br />6. Add Qt commands to PATH (e.g. qmake)<br />* Create qt5.sh file<br /></code>sudo gedit /etc/profile.d/qt5.sh</code>
+
sudo cp -P /opt/gcc-4.8.1/lib64/libstdc.so.6 /usr/lib64
<br />* Add the following lines to qt5.sh<br /><code>PATH=/opt/Qt5.1.1/5.1.1/gcc_64/bin:$PATH<br />export PATH</code>
+
sudo cp /opt/gcc-4.8.1/lib64/libstdc.so.6.0.18 /usr/lib64/
<br />* Save and close qt5.sh
+
sudo ldconfig -v</code>
<br />* Run qt5.sh<br /><code>. /etc/profile.d/qt5.sh<code>
+
 
<br />* Verify that qmake is version 5.1.1<br /></code>which qmake</code>
+
5. Download and install [http://qt.io/ Qt] 5.1.1 or latest version
<br />7. Edit Qt Creator desktop configuration file to allow all users to run<br /><code>sudo gedit /usr/share/applications/DigiaQtOpenSource-qtcreator.desktop<code><br />* Comment out or remove the line “Path=/root”<br />* Save and close DigiaQtOpenSource-qtcreator.desktop
+
<code>sudo ./qt-linux-opensource-5.1.1-x86_64-offline.run</code>
<br />h2. Installing Qwt 6.1.0 on CentOS 6.4
+
 
<br />1. Install mesa-libGLU-devel<br /></code>sudo yum install mesa-libGLU-devel</code>
+
6. Add Qt commands to PATH (e.g. qmake)
<br />2. Download and install &quot;Qwt &quot;:http://qwt.sourceforge.net/ 6.1.0 or latest version<br /><code>tar xvjf qwt-6.1.0.tar.bz2<br />cd qwt-6.1.0</code><br />* Configure qwtconfig.pri<br /><code>gedit qwtconfig.pri<code><br />* Change QWT_INSTALL_PREFIX to /opt/qwt-$$QWT_VERSION”<br />* Configure rest of qwtconfig.pri and comment/uncomment plugins as desired<br />* Save and close qwtconfig.pri<br />* Build and install Qwt<br /></code>qmake qwt.pro<br />make<br />sudo make install<code>
+
* Create qt5.sh file
<br />3. Link Qwt plugin to Qt<br /></code>sudo ln -s /opt/qwt-6.1.0/plugins/designer/libqwt_designer_plugin.so /opt/Qt5.1.1/Tools/QtCreator/bin/plugins/designer/</code>
+
<code>sudo gedit /etc/profile.d/qt5.sh</code>
<br />4. Create qwt ld.so configuration file<br /><code>echo /opt/qwt-6.1.0/lib | sudo tee /etc/ld.so.conf.d/qwt.conf<br />sudo ldconfig -v</code>
+
 
<br />5. Add the following lines to the .pro file of the Qt project in which you want to use Qwt plugins<br /><code>#QWT<br />QWT_LOCATION = /opt/qwt-6.1.0<br />INCLUDEPATH''= $${QWT_LOCATION}/include/<br />LIBS += -L$${QWT_LOCATION}/lib -lqwt</code>
+
* Add the following lines to qt5.sh
 +
<code>PATH=/opt/Qt5.1.1/5.1.1/gcc_64/bin:$PATH
 +
export PATH</code>
 +
 
 +
* Save and close qt5.sh
 +
 
 +
* Run qt5.sh
 +
<code>. /etc/profile.d/qt5.sh</code>
 +
 
 +
* Verify that qmake is version 5.1.1
 +
<code>which qmake</code>
 +
 
 +
7. Edit Qt Creator desktop configuration file to allow all users to run
 +
<code>sudo gedit /usr/share/applications/DigiaQtOpenSource-qtcreator.desktop</code>
 +
* Comment out or remove the line "Path=/root"
 +
* Save and close DigiaQtOpenSource-qtcreator.desktop
 +
 
 +
== Installing Qwt 6.1.0 on CentOS 6.4 ==
 +
1. Install mesa-libGLU-devel
 +
<code>sudo yum install mesa-libGLU-devel</code>
 +
 
 +
2. Download and install [http://qwt.sourceforge.net/ Qwt ] 6.1.0 or latest version
 +
<code>tar xvjf qwt-6.1.0.tar.bz2
 +
cd qwt-6.1.0</code>
 +
* Configure qwtconfig.pri
 +
<code>gedit qwtconfig.pri</code>
 +
* Change QWT_INSTALL_PREFIX to "/opt/qwt-$$QWT_VERSION"
 +
* Configure rest of qwtconfig.pri and comment/uncomment plugins as desired
 +
* Save and close qwtconfig.pri
 +
* Build and install Qwt
 +
<code>qmake qwt.pro
 +
make
 +
sudo make install</code>
 +
 
 +
3. Link Qwt plugin to Qt
 +
<code>sudo ln
 +
-s /opt/qwt-6.1.0/plugins/designer/libqwt_designer_plugin.so /opt/Qt5.1.1/Tools/QtCreator/bin/plugins/designer/</code>
 +
 
 +
4. Create qwt ld.so configuration file
 +
<code>echo /opt/qwt-6.1.0/lib | sudo tee /etc/ld.so.conf.d/qwt.conf
 +
sudo ldconfig -v</code>
 +
 
 +
5. Add the following lines to the .pro file of the Qt project in which you want to use Qwt plugins
 +
<code>#QWT
 +
QWT_LOCATION = /opt/qwt-6.1.0
 +
INCLUDEPATH''= $${QWT_LOCATION}/include/
 +
LIBS += -L$${QWT_LOCATION}/lib -lqwt</code>

Latest revision as of 14:43, 1 October 2020


Overview

If you are trying to install Qt and Qwt (Qt Widgets for Technical Applications) on CentOS, then the following instructions should be of good use. These steps were created, after many a trial and error, using Qt 5.1.1 and Qwt 6.1.0 on CentOS 6.4 x86 64bit. These steps have proven to work on several CentOS machines and could also work on Fedora and Red Hat.

Feel free to use newer versions of the install packages, but just make sure to alter the version numbers in the steps as applicable. Also, most dependencies are covered in these instructions, but there may be others that you will have to find if something fails to build properly.

Installing Qt 5.1.1 on CentOS 6.4

1. Install Development Tools sudo yum groupinstall "Development Tools"

2. Install glibc-devel.i686 (the 32-bit version is required to build GCC) sudo yum install glibc-devel.i686

3. Download and install GCC 4.8.1 or latest version. Instructions copied from here tar xvjf gcc-4.8.1.tar.bz2 cd gcc-4.8.1 ./contrib/download_prerequisites cd .. mkdir objdir cd objdir $PWD/../gcc-4.8.1/configure —prefix=$HOME/gcc-4.8.1 make sudo make install

4. Copy new GCC libraries to /usr/lib64 sudo mv /usr/lib64/libstdc+.so.6 /usr/lib64/libstdc.so.6.backup sudo cp -P /opt/gcc-4.8.1/lib64/libstdc.so.6 /usr/lib64 sudo cp /opt/gcc-4.8.1/lib64/libstdc.so.6.0.18 /usr/lib64/ sudo ldconfig -v

5. Download and install Qt 5.1.1 or latest version sudo ./qt-linux-opensource-5.1.1-x86_64-offline.run

6. Add Qt commands to PATH (e.g. qmake)

  • Create qt5.sh file

sudo gedit /etc/profile.d/qt5.sh

  • Add the following lines to qt5.sh

PATH=/opt/Qt5.1.1/5.1.1/gcc_64/bin:$PATH export PATH

  • Save and close qt5.sh
  • Run qt5.sh

. /etc/profile.d/qt5.sh

  • Verify that qmake is version 5.1.1

which qmake

7. Edit Qt Creator desktop configuration file to allow all users to run sudo gedit /usr/share/applications/DigiaQtOpenSource-qtcreator.desktop

  • Comment out or remove the line "Path=/root"
  • Save and close DigiaQtOpenSource-qtcreator.desktop

Installing Qwt 6.1.0 on CentOS 6.4

1. Install mesa-libGLU-devel sudo yum install mesa-libGLU-devel

2. Download and install Qwt 6.1.0 or latest version tar xvjf qwt-6.1.0.tar.bz2 cd qwt-6.1.0

  • Configure qwtconfig.pri

gedit qwtconfig.pri

  • Change QWT_INSTALL_PREFIX to "/opt/qwt-$$QWT_VERSION"
  • Configure rest of qwtconfig.pri and comment/uncomment plugins as desired
  • Save and close qwtconfig.pri
  • Build and install Qwt

qmake qwt.pro make sudo make install

3. Link Qwt plugin to Qt sudo ln -s /opt/qwt-6.1.0/plugins/designer/libqwt_designer_plugin.so /opt/Qt5.1.1/Tools/QtCreator/bin/plugins/designer/

4. Create qwt ld.so configuration file echo /opt/qwt-6.1.0/lib | sudo tee /etc/ld.so.conf.d/qwt.conf sudo ldconfig -v

5. Add the following lines to the .pro file of the Qt project in which you want to use Qwt plugins #QWT QWT_LOCATION = /opt/qwt-6.1.0 INCLUDEPATH= $${QWT_LOCATION}/include/ LIBS += -L$${QWT_LOCATION}/lib -lqwt