/home/pengyc/ctools/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin
sudo apt-get install lsb-core lib32stdc++6
Qt arm 源码移植编译过程
https://download.qt.io/archive/qt/5.12/5.12.9/single/qt-everywhere-src-5.12.9.tar.xz
qt-everywhere-src-5.12.9.tar.xz
tar xf qt-everywhere-src-5.12.9.tar.xz
cd qt-everywhere-src-5.12.9/
pengyc@tengmai:~/DockPro/ZLG/QtSource/Qt5.12.9 /mkdir arm_Qt5.12.9
vi qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
pengyc@tengmai:~/DockPro/ZLG/QtSource/Qt5.12.9/qt-everywhere-src-5.12.9$ vi ./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
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++
modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)
pengyc@tengmai:~/DockPro/ZLG/QtSource/Qt5.12.9/qt-everywhere-src-5.12.9$ vi autoconfigure.sh
autoconfigure.sh 文件内容:
./configure -prefix /home/pengyc/DockPro/ZLG/QtSource/Qt5.12.9/arm_Qt5.12.9 \
-opensource \
-confirm-license \
-release \
-strip \
-evdev \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/home/pengyc/DockPro/ZLG/Lib/tslib/tslib/include \
-L/home/pengyc/DockPro/ZLG/Lib/tslib/tslib/lib \
-recheck-all
注意点:
/home/pengyc/DockPro/ZLG/QtSource/Qt5.12.9/arm_Qt5.12.9 \ 为编译输出路径。
-I/home/pengyc/DockPro/ZLG/Lib/tslib/tslib/include \ 指定 tslib 头文件路径
-L/home/pengyc/DockPro/ZLG/Lib/tslib/tslib/lib \ 指定 tslib 相关库文件路径
chmod u+x autoconfigure.sh./autoconfigure.sh
time (make -j 16) // -j 16 代表最多允许 16 条编译指令同时运行,参数 16,一般为个人分配给虚拟机的核心数的 2 倍,前面加个 time 是测试编译时间. 尽量不要使用 root 用户和 sudo 权限来编译!
make installls arm_Qt5.12.9
/etc/profile 修改指定库目录就可以运行Qt程序了。
make clean //清除编译结
time (make -j 16) //编译
-j 16 代表最多允许 16 条编译指令同时运行,参数 16,一般为个人分配给虚拟机的核心数的 2 倍,前面加个 time 是测试编译时间. 尽量不要使用 root 用户和 sudo 权限来编译!
在autoconfigure.sh添加 -alsa \
文件路径如下:\172.20.60.155\share_pengyc\DockPro\ZLG\QtSource\Qt5.12.9\qt-everywhere-src-5.12.9\qtbase\src\platformsupport\devicediscovery\qdevicediscovery_hotplug.cpp\172.20.60.155\share_pengyc\DockPro\ZLG\QtSource\Qt5.12.9\qt-everywhere-src-5.12.9\qtbase\src\platformsupport\devicediscovery\qdevicediscovery_hotplug_p.h
3. 修改devicediscovery.pri 文件内容
将qdevicediscovery_static.cpp和qdevicediscovery_static_p.h 改成如下:
WARNING: Cross compiling without sysroot. Disabling pkg-config
ERROR: Feature ‘alsa’ was enabled, but the pre-condition ‘config.unix && !config.qnx && libs.alsa’ failed.
sudo apt-get install alsaxx
接着如果之前已经编译过源码,需要先 make clean清理一下,重新编译。