正常情况下,设置toolchain的环境后,配置compile.sh的编译模块,make就行:
. /home/svn_top/env_set_hisi.sh
cd /home/work/qt-everywhere-opensource-src-4.8.6/
make confclean
vi compile.sh
cat compile.sh
./compile.sh
make
make install
但是编译会遇到一些问题:
1、之前使用hisiv400编译的,make confclean后,添加修改mkspecs/qws/linux-arm-himix200-g++/qmake.conf,将编译相关的工具都设置好,compile.sh为:
#!/bin/bash
./configure -v --prefix=/opt/Qtopia4.8.6/ -prefix-install -no-pch -xplatform qws/linux-arm-himix200-g++ -arch arm -embedded arm -qt-freetype -no-largefile -fast -release -no-qt3support -no-cups -no-opengl -no-phonon -phonon-backend -no-scripttools -no-libtiff -no-gif -no-libmng -no-nis -no-svg -qt-mouse-tslib -qt-gfx-transformed -qt-gfx-linuxfb
执行会发现还有hisiv400相关的一些信息,make confclean没有清除,使用make distclean将生成的文件完全清除即可。
2、执行compile.sh后出现tslib找不到的信息,使用toolchain重新编译tslib:
./configure --prefix=/home/work/crosscompile/tslib/tslib_install --host=arm-linux --target=arm-linux CC=arm-himix200-linux-gcc
make & make install后,在qt编译脚本compile.sh中加入tslib头文件和lib路径:
#!/bin/bash
./configure -v --prefix=/opt/Qtopia4.8.6/ -prefix-install -no-pch -xplatform qws/linux-arm-himix200-g++ -arch arm -embedded arm -qt-freetype -no-largefile -fast -release -no-qt3support -no-cups -no-opengl -no-phonon -phonon-backend -no-scripttools -no-libtiff -no-gif -no-libmng -no-nis -no-svg -qt-mouse-tslib -qt-gfx-transformed -qt-gfx-linuxfb -I/home/work/crosscompile/tslib/tslib_install/include -L/home/work/crosscompile/tslib/tslib_install/lib
再次执行,configure可以了。
3、make的时候出现 error: ‘std::tr1’ has not been declared 报错:
In file included from ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h:84:0,
from ../3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h:24,
from ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp:50:
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:69: error: ‘std::tr1’ has not been declared
template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:74: error: expected ‘{’ before ‘has_trivial_constructor’
template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
^~~~~~~~~~~~~~~~~~~~~~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:68: error: ‘std::tr1’ has not been declared
template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:73: error: expected ‘{’ before ‘has_trivial_destructor’
template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
arm-himix200-linux-g++版本比较高,可能默认使用了c++高版本,在mkspecs/qws/linux-arm-himix200-g++/qmake.conf文件QMAKE_CXXFLAGS加入使用c++98的编译选项:
root@ubuntu:/home/work/qt-everywhere-opensource-src-4.8.6# cat mkspecs/qws/linux-arm-himix200-g++/qmake.conf
#
# qmake configuration for building with arm-himix200-linux-g++
#
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = arm-himix200-linux-gcc
QMAKE_CXX = arm-himix200-linux-g++
QMAKE_LINK = arm-himix200-linux-g++
QMAKE_LINK_SHLIB = arm-himix200-linux-g++
QMAKE_CFLAGS += -march=armv7-a
QMAKE_CXXFLAGS += -std=gnu++98 -march=armv7-a
# modifications to linux.conf
QMAKE_AR = arm-himix200-linux-ar cqs
QMAKE_OBJCOPY = arm-himix200-linux-objcopy
QMAKE_STRIP = arm-himix200-linux-strip
#QMAKE_CFLAGS_RELEASE += -march=armv7
#QMAKE_CXXFLAGS_RELEASE += -march=armv7
load(qt_config)
4、再次编译,出现找不到libts.so的错误:warning: libts-1.0.so.0, needed by /myroot/qt/qtlib/lib/libQtGui.so, not found (try using -rpath or -rpath-link),与https://blog.csdn.net/weixin_36397141/article/details/54618202相同,最终的解决办法是将compile.sh的tslib路径去掉,将tslib编译出来的include和lib文件复制到toolchain的路径下:
cp /home/work/crosscompile/tslib/tslib_install/include/tslib.h /opt/hisi-linux/x86-arm/arm-himix200-linux/target/usr/include/
cp /home/work/crosscompile/tslib/tslib_install/lib/libts.so* /opt/hisi-linux/x86-arm/arm-himix200-linux/include/
compile.sh
#!/bin/bash
./configure -v --prefix=/opt/Qtopia4.8.6/ -prefix-install -no-pch -xplatform qws/linux-arm-himix200-g++ -arch arm -embedded arm -qt-freetype -no-largefile -fast -release -no-qt3support -no-cups -no-opengl -no-phonon -phonon-backend -no-scripttools -no-libtiff -no-gif -no-libmng -no-nis -no-svg -qt-mouse-tslib -qt-gfx-transformed -qt-gfx-linuxfb
重新make distclean,make,make install即可。