TX1入门教程软件篇-安装Qt
TX1入门教程软件篇-安装Qt
说明:
- 介绍如何在TX1上安装Qt
步骤:
- 下载qt:
- 地址:安装包qt-everywhere-opensource-src-5.5.1
- 解压后,修改文件qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
- 修改如下:
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = gcc
QMAKE_CXX = g++
QMAKE_LINK = g++
QMAKE_LINK_SHLIB = g++
# modifications to linux.conf
QMAKE_AR = ar cqs
QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_STRIP = strip
load(qt_config)
- 修改qt.pro,去掉文件最后部分的一些不想编译的模块,比如:
addModule(qtbase)
addModule(qtandroidextras, qtbase)
addModule(qtmacextras, qtbase)
addModule(qtx11extras, qtbase)
addModule(qtsvg, qtbase)
addModule(qtxmlpatterns, qtbase)
addModule(qtdeclarative, qtbase, qtsvg qtxmlpatterns)
addModule(qtquickcontrols, qtdeclarative, qtgraphicaleffects)
addModule(qtmultimedia, qtbase, qtdeclarative)
addModule(qtwinextras, qtbase, qtdeclarative qtmultimedia)
addModule(qtactiveqt, qtbase)
addModule(qtsystems, qtbase, qtdeclarative)
addModule(qtlocation, qtbase, qtdeclarative qtquickcontrols qtsystems)
addModule(qtsensors, qtbase, qtdeclarative)
#addModule(qtconnectivity, qtbase $$ANDROID_EXTRAS, qtdeclarative)
addModule(qtfeedback, qtdeclarative, qtmultimedia)
addModule(qtpim, qtdeclarative)
addModule(qtwebsockets, qtbase, qtdeclarative)
addModule(qtwebchannel, qtbase, qtdeclarative qtwebsockets)
addModule(qtwebkit, qtbase, qtdeclarative qtlocation qtmultimedia qtsensors qtwebchannel qtxmlpatterns, WebKit.pro)
addModule(qttools, qtbase, qtdeclarative qtactiveqt qtwebkit)
addModule(qtwebkit-examples, qtwebkit qttools)
addModule(qtimageformats, qtbase)
#addModule(qt3d, qtdeclarative qtimageformats)
#addModule(qtcanvas3d, qtdeclarative)
addModule(qtgraphicaleffects, qtdeclarative)
addModule(qtscript, qtbase, qttools)
addModule(qtquick1, qtscript, qtsvg qtxmlpatterns qtwebkit)
addModule(qtdocgallery, qtdeclarative)
#addModule(qtwayland, qtbase, qtdeclarative)
addModule(qtserialport, qtbase)
addModule(qtenginio, qtdeclarative)
addModule(qtwebengine, qtquickcontrols qtwebchannel, qtwebkit qtlocation)
addModule(qttranslations, qttools)
addModule(qtdoc, qtdeclarative)
addModule(qtqa, qtbase)
- 到这里,qt里面需要修改的就完成了,但还需要对系统环境做些处理,让其满足qt的编译.
- 修改.bashrc,添加:
export SYSROOT
export PKG_CONFIG_SYSROOT_DIR=/
export PKG_CONFIG_LIBDIR=$SYSROOT/usr/lib/arm-linux-gnueabihf/pkgconfig:$SYSROOT/usr/share/pkgconfig:$SYSROOT/usr/lib/pkgconfig
export PKG_CONFIG_PATH=$SYSROOT/usr/lib/arm-linux-gnueabihf/pkgconfig:$SYSROOT/usr/share/pkgconfig:$SYSROOT/usr/lib/pkgconfig
- 执行source ~/.bashrc让其生效.
- 执行下面的命令,安装对xcb的依赖:
sudo apt-get install 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-sync1 libxcb-sync-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev
- 开始编译qt:
ubuntu@tegra-ubuntu:~/qt-everywhere-opensource-src-5.5.1$ mkdir build
ubuntu@tegra-ubuntu:~/qt-everywhere-opensource-src-5.5.1$ cd build/
ubuntu@tegra-ubuntu:~/qt-everywhere-opensource-src-5.5.1/build$ ls
ubuntu@tegra-ubuntu:~/qt-everywhere-opensource-src-5.5.1/build$ sudo mkdir /opt/qt; ../configure -verbose -release -opensource -xplatform linux-arm-gnueabi-g++ -prefix /opt/qt -no-c++11 -qt-zlib -qt-xcb
[sudo] password for ubuntu:
+ cd qtbase
+ /home/ubuntu/qt-everywhere-opensource-src-5.5.1/qtbase/configure -top-level -verbose -release -opensource -xplatform linux-arm-gnueabi-g++ -prefix /opt/qt -no-c++11 -qt-zlib -qt-xcb
This is the Qt Open Source Edition.
You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) versions 3.
Type '3' to view the GNU Lesser General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.
Do you accept the terms of either license? yes
- 继续编译:
nmake -j4
sudo make install
- 最后在~/.bashrc添加:
export PATH=/opt/qt/bin:$PATH
export LD_LIBRARY_PATH=/opt/qt/lib:$LD_LIBRARY_PATH
- 更新环境:
source ~/.bashrc
- 检查是否成功:
qmake -version
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号