QT5.5.0 Linux 安装

QT  源码下载

链接为:http://download.qt.io/archive/qt/

我选择的QT版本为5.5.0

想要能够在新安装的ubuntu系统里安装QT库,以下依赖库必须要安装,否则会出现错误而导致无法正确编译QT

1. Dependencies

The code should be easily built on any Linux distribution which has development packages for Qt installed. Below is the list of dependencies:

  • Qt version 4.8.0 or later

  • gperf (v3.0 or later)

  • bison (v2.4.1 or later)

  • flex (v2.5.33 or later)

  • sqlite (development files)

  • fontconfig (development files)

  • xrender (development files)

  • phonon (development files)

  • libjpeg (development files)

  • libpng (development files)

 在linux系统里解压QT源码

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

在源码解压目录下有REAME 文件

Linux: On systems running X11, the XCB libraries are required for

     the platform plugin to build. qtbase/src/plugins/platforms/xcb/README     lists the required packages.

在此文件中,有说明Ubuntu11.4版本所要安装的依赖包。

On Ubuntu 12.04 icccm1 is replaced by icccm4 and xcb-render-util can be installed automatically:

libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-    render-util0 libxcb-render-util0-dev libxcb-glx0-dev

之 后再安装 sudo apt-get install bison flex libqt4-dev libqt4-opengl-dev libphonon-dev libicu-dev libsqlite3-dev libxext-dev libxrender-dev gperf libfontconfig1-dev libphonon-dev libpng12-dev libjpeg62-dev g++

 

在QT源码根目录下,在终端中输入以下内容

./configure -prefix /home/ubuntu/Desktop/qt-linux-5.5.0      安装的路径为 /home/ubuntu/Desktop/qt-linux-5.5.0

等待qmake执行生成配置文件后,接着

make -j2    进行编译,这个过程需要两个小时到三个小时

等编译完成后,执行

make install  此时QT库就会安装在 /home/ubuntu/Desktop/qt-linux-5.5.0下

此时QT库就安装完成

交叉编译QT

cd  qtbase/mkspecs

cp -a linux-arm-gnueabi-g++/  arm-xilinx-linux-gnueabi-g++

cd  /arm-xilinx-linux-gnueabi-g++

vi qmake.conf

添加

QT_QPA_DEFAULT_PLATFORM=linuxfb

QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a

QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a

我使用的交叉编译器为arm-xilinx-linux-gnueabi-g++

把默认的编译器修改为自己开发过程中所需要的交叉编译器

 QMAKE_CC = arm-linux-gnueabi-gcc

修改为 QMAKE_CC=arm-xilinx-gnueabi-gcc

后面的仿照上面两行修改即可,保存退出

如何切换该QT源码的根目录下

执行: ./configure -prefix /home/ubuntu/Desktop/qt-arm-5.5.0 -xplatform arm-xilinx-linux-gnueabi-g++ -no-sse2 -no-largefile -no-qml-debug -no-gtkstyle -no-opengl -no-pkg-config -no-openssl -no-iconv -nomake examples -no-c++11 -skip qt3d -skip qtcanvas3d -skip qtdoc -skit qtwayland

输入o

再次输入yes

等待配置文件生成,此时需要耗时一两分钟,然后执行

make -j2  开始2线程进行编译,编译完成后执行

make install

安装完成后,在/home/ubuntu/Desktop/qt-arm-5.5.0文件夹下可以找到交叉编译后所需要的库文件

 

接着安装QT  creator

比较新的为下载链接http://download.qt.io/official_releases/qtcreator/

 安装QT creator跟windows下安装软件一样

 

Ubuntu下安装QT完成后每次打开都显示: 
The following plugins have errors and can not be loaded: 
Help 
Details: 
….Cannot load library /…/…/…/libHelp.so:(Cannot open shared object file: No such file or directory) 


解决办法: 
sudo apt-get install libgstreamer0.10-dev 
sudo apt-get install libgstreamer-plugins-base0.10-dev

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值