jetson nano手动安装qt5.12.9及qtcreator4.12.2_jetson nano qt-爱代码爱编程
检查是否安装cmake:
cmake --version
如果有不用管,没有安装的话参考这位老兄的【Linux】JetsonNano安装CMake教程安装,亲测好使。
安装依赖项:
sudo apt-get install build-essential perl python3 git
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
sudo apt-get install libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libxtst-dev libxss-dev libdbus-1-dev libevent-dev libfontconfig1-dev libcap-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libegl1-mesa-dev gperf bison nodejs
sudo apt-get install libasound2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev
sudo apt install clang libclang-dev
去网页下载qt安装包:
访问 https://download.qt.io/archive/qt/5.12/5.12.9/single/
下载 qt-everywhere-src-5.12.9.tar.xz
下载之后在终端依次输入:
cd /home/nvidia/Downloads (你下载qt的位置)
sudo tar -xvf qt-everywhere-src-5.12.9.tar.xz (解压)
cd qt-everywhere-src-5.12.9 (进入解压的文件)
sudo touch auto.sh (创建auto脚本文件)
sudo chmod 755 auto.sh (赋予权限)
sudo gedit auto.sh (打开auto脚本文件)
在打开的auto.sh脚本文件在输入以下内容并保存退出:
#! /bin/bash
./configure -prefix /opt/Qt/ \
-opensource -confirm-license \
-nomake examples \
-nomake tests \
-release \
-skip qt3d \
-skip qtcharts \
-skip qtandroidextras \
-skip qtlocation \
因为jetson nx的编译平台是linux-aarch64-gnu-g++,所以我们还需要一下配置qmake.conf文件
sudo gedit qtbase/mkspecs/linux-aarch64-gnu-g++/qmake.conf
在打开的qmake.conf文件内容最后输入以下内容并保存退出:
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv8-a -lts
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv8-a -lts
在终端依次输入:
cd .. (返回上一级目录)
sudo mv qt-everywhere-src-5.12.9 /opt/ (移动qt-everywhere-src-5.12.9到/opt路径下)
cd /opt/qt-everywhere-src-5.12.9
sudo chmod +111 ./auto.sh
sudo ./auto.sh (编译makefile文件)
sudo make (此过程大约需要7-8小时,中途暂停需按Ctrl+C,然后需要软件关机,切勿直接断电。)
sudo make install (此过程大约十几分钟,此命令会将程序安装在/opt/Qt/ 中。)
安装成功后修改环境变量:
sudo gedit /etc/profile
在打开的profile文件最后输入以下内容并保存退出:
export QTDIR=/opt/Qt
export PATH=$QTDIR/bin:$PATH
export MANPATH=$QTDIR/man:$MANPATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
sudo gedit ~/.bashrc
在打开的bashrc文件最后输入以下内容并保存退出:
# qt path config
export PATH=/opt/Qt/bin:$PATH
export LD_LIBRARY_PATH=/opt/Qt/lib:$LD_LIBRARY_PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/Qt/plugins/platforms
在终端输入:
qmake -v
看系统是否识别到Qt 5.12.9,如果没有识别到责输入reboot重启之后再输入qmake -v,识别到Qt 5.12.9之后再安装QtCreator
安装qtcreator必须先安装Qt,并且用Qt的qmake编译qtcreator
去网页下载qt安装包:
访问 https://download.qt.io/archive/qtcreator/4.12/4.12.2/
下载 qt-creator-opensource-src-4.12.2.tar.gz
在终端依次输入:
cd /Downloads (你下载qt的位置)
tar -zxvf qt-creator-opensource-src-4.12.2.tar.gz (解压)
sudo mv qt-creator-opensource-src-4.12.2 /opt/
qmake -r
sudo make (这一步时间非常长,我这步耗费了大概七个小时)
sudo make install
启动qtcreator:
/opt/qt-creator-opensource-src-4.12.2/bin/qtcreator.sh &
启动之后配置Qt环境:
打开Tools-Options-kits
Qt Versions点add 路径:Computer-/-opt-Qt-bin-qmake
进入kits栏 Qt Versions一栏选5.12.9版本,Degubber一栏选system GDB
!!!!!!至此QT安装圆满完成!!!!!!