硬件:mangopi MQ-R(T113-s3)
SDK: Tina
tslib:已经使用这个编译器编译、安装好了,位置在:/opt/tslib-t113
交叉编译器:Tina SDK自带的编译器
文件:/etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
export PATH=$PATH:/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin
export PATH=$PATH:/usr/local/arm/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin
# T113-s3 Tina-Linux Path
export PATH=$PATH:/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin
export STAGING_DIR=$STAGING_DIR:/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/out/t113-mq_r/staging_dir
如上最后两句已经添加了Tina SDK的交叉编译器的位置,和“STAGING_DIR”这个该死的环境变量
并且在终端也可以看到这个环境变量:
liefyuan@ubuntu:~/qt-src/qt-everywhere-src-5.12.9$ echo $STAGING_DIR
:/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/out/t113-mq_r/staging_dir
编辑文件:vim 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
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-gcc
QMAKE_CXX = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-g++
QMAKE_LINK = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-g++
QMAKE_LINK_SHLIB = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-g++
# modifications to linux.conf
QMAKE_AR = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-ar cqs
QMAKE_OBJCOPY = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-objcopy
QMAKE_NM = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-nm -P
QMAKE_STRIP = /home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-muslgnueabi-strip
load(qt_config)
~
配置文件 $ vim autoconfigure.sh
#!/bin/sh
export PATH=$PATH:/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin
./configure \
-prefix /opt/qt5.12.9-arm-t113 \
-opensource \
-confirm-license \
-release \
-strip \
-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 \
-nomake 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/opt/tslib-t113/include \
-L/opt/tslib-t113/lib \
-plugin-sql-sqlite \
-I/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/ \
-I/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/allwinner/ \
-I/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/include/allwinner/include/ \
-L/home/liefyuan/Liefyuan/Tina-Linux/Tina-Linux/out/t113-mq_r/staging_dir/target/usr/lib/ \
-recheck-all
配置命令:$ ./autoconfigure.sh
编译命令:$ time sudo make -j16
配置没有问题
就是在编译的时候报错:
arm-openwrt-linux-muslgnueabi-g++.bin: warning: environment variable 'STAGING_DIR' not defined
arm-openwrt-linux-muslgnueabi-g++.bin: warning: environment variable 'STAGING_DIR' not defined
.obj/qlogging.o: In function `qFormatLogMessage(QtMsgType, QMessageLogContext const&, QString const&)':
qlogging.cpp:(.text+0x434c): undefined reference to `backtrace'
qlogging.cpp:(.text+0x440c): undefined reference to `backtrace_symbols'
collect2: error: ld returned 1 exit status
Makefile:1245: recipe for target '../../lib/libQt5Core.so.5.12.9' failed
make[3]: *** [../../lib/libQt5Core.so.5.12.9] Error 1
make[3]: Leaving directory '/home/liefyuan/qt-src/qt-everywhere-src-5.12.9/qtbase/src/corelib'
Makefile:226: recipe for target 'sub-corelib-make_first' failed
make[2]: *** [sub-corelib-make_first] Error 2
make[2]: Leaving directory '/home/liefyuan/qt-src/qt-everywhere-src-5.12.9/qtbase/src'
Makefile:50: recipe for target 'sub-src-make_first' failed
make[1]: *** [sub-src-make_first] Error 2
make[1]: Leaving directory '/home/liefyuan/qt-src/qt-everywhere-src-5.12.9/qtbase'
Makefile:58: recipe for target 'module-qtbase-make_first' failed
make: *** [module-qtbase-make_first] Error 2
real 0m38.265s
user 7m2.573s
sys 1m21.482s
网上能看的解答都看了:
【V853开发板试用】编译QT测试下
tina2.5|openwrt 交叉编译错误解决方法warning: environment variable 'STAGING_DIR' not defined
全志D1-H,官方SDK Tina2.0 移植 QT5.15
确实是没有办法了,向大佬们求救!
解决这个问题之后我会写一个详细的博客来介绍的:博客占坑:【Mangopi MQ-R:T113-s3编译Tina Linux系统(三)加Qt5】
最近编辑记录 liefyuan (2022-09-30 01:36:44)
离线
直接把报错的这个函数注释掉就可以了
离线
T113应该比较好解决,毕竟是ARM端的,我一般编译QT就三个地方修改,一个就是环境使用的交叉编译器,修改一个总的,在修改下QT下的配置,再建个脚本就行了,基本很简单就完成了,可以参考正点原子的教程,他们又QT移植案例
离线
请问楼主前辈,这个问题解决了吗?我卡在这步好多天了,不知道怎么生成qmake。请教!sudo make的结果如下
离线
请问楼主前辈,这个问题解决了吗?我卡在这步好多天了,不知道怎么生成qmake。请教!sudo make的结果如下https://whycan.com/files/members/13702/1704720427244.png
可以考虑单独编译qt,自带的那个不好搞。
离线
过了快一年了,又编译了一遍qt,基于t113s3的tina2.1sdk。又遇到这些问题。感谢楼主的分享。
autoconfigure.sh脚本里一开始的export STAGING_DIR命令,执行脚本后,貌似没起作用,编译会有警告STAGING_DIR是空的,然后编译会报错,qlogging.cpp: `backtrace'啥的。在执行脚本前,在命令行里手动执行下export STAGING_DIR=XXX,就不会报这些错误。
在ubuntu22.04下编译qt5.12,还会有些报错,和std:min std:max相关的,找到报错的文件,加上#include<limits>即可解决。
在ubuntu22.04下编译qt5.15,也有报错,好像是std:某个模板参数不能为空,没找到解决办法,不过看编译过程的提示需要GCC版本大于7,sdk自带的是6.x版本。于是放弃qt5.15转而下载qt5.12。tina5.x的gcc版本有10和11,也许不会报这些错误。
另编译qt时,这个STAGING_DIR到底是干啥的?虽然修改为只想sdk/out/xxx/staging_dir后编译通过了,但是想知道其用途。
最近编辑记录 Gentlepig (2024-11-21 09:19:59)
离线