Compile and install QT4 (ii)

Source: Internet
Author: User

Preface

?? The previous article said that I to solve the qaction icon can not display the problem of choosing to install the QT5, but after the installation, I recompile the source code, found a lot of errors, many Qt4 in the header files, Qt5 compiled said not found. After searching the internet, said Qt5 and Qt4 difference is still very big, Compatibility is not very good. Although there are some articles that address Qt4 to QT5, they are cumbersome and do not necessarily succeed, and other problems may occur after the transplant. So I decided to install QT4,QT5 and not uninstall, these two can coexist.

Qt4.8.6

?? Because I do not want too much trouble, I found the following online method, directly with Apt-get install installation, simple and convenient.
Attach the link to the original posts: http://baike.baidu.com/link?url=q4fvHa8bwl-lTsww3azEJKDQ-a8UDMq75WXkQKrggw6LccZC3sULPNdEOK_ Kjdhzdh65yx319kfckupavehxta

sudo apt-get install qt4-dev-tools   #开发包sudo apt-get install qtcreator       #IDEsudo apt-get install qt4-doc         #开发帮助文档sudo apt-get install qt4-qtconfig    #配置工具sudo apt-get install qt4-demos       #DEMO源码

Installation is smooth, one step, but try to compile my source code, the icon is still not displayed. Alas, it seems that some trouble can not be saved, shortcuts are not so good to go. I'm just going to compile and install it. This time choose to compile and install Qt4.8.5 (afraid in case the problem is Qt4.8.6, do not want to toss, in fact, should not).

compiling and installing Qt4.8.5


1. Download Qt4.8.5 's source code on the website
QT version of the source code
Select Download: qt-everywhere-opensource-src-4.8.5.tar.gz

2. Unzip:

tar  -zxvf qt-everywhere-opensource-src-4.8.5.tar.gz


3. Enter the source directory

 cd qt-everywhere-opensource-src-4.8.5/

? See these files:


4. Installing the QT Dependency Pack

sudo apt-get install  libX11-devsudo apt-get install  libXext-devsudo apt-get install  libXtst-dev


5. Compiling the installation

sudo apt-get install libfontconfig*

Note: This is the library file that installs the Fontconfig section, in order to support Chinese display

.-fontconfig-prefix /opt/qt-4.8.5-x11

Note: Here must add-fontconfig parameters, online Many did not add, because this fontconfig library is used to support Chinese, if not added this parameter, the QT interface will not be able to display the Chinese language, encountered in the Chinese place will be blank. I was the first time without add, and finally can only be recompiled installed once.

sudo   make

Note: Compile time is very long, about 1-2 hours, wait patiently, can do other things

sudo  make  install

If you do not encounter any exotic problems, this will be installed successfully.

6. Configure Environment variables

cd   /etc/
sudo  vim  profile

? Add the following code to the end of the file and save the exit:

export QTDIR=/opt/qt-4.8.5-x11export PATH=/opt/qt-4.8.5-x11/bin:$PATH(PATH=$QTDIR/bin:$PATH)export MANPATH=$QTDIR/man:$MANPATHexport LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

? Terminal Execution Command:

source    profile


7. About Qmake
?? Smooth, qmake can be used directly, if not used, it is necessary to manually create a soft link, as the previous installment Qt5.

cd   /usr/bin
sudo  ln  -s  /opt/qt-4.8.5-x11/bin/qmake  qmake

Note: The soft link name to distinguish with QT5, my Qt4 uses the QMAKE,QT5 with the QMAKE-QT5

? To view the QT version:

qmake   -v

? To view the Qmake path:

which   qmake

?? OK, Qt4.8.5 has been installed. Try again, my problem solved, qaction icon normal display.

Compile and install QT4 (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.