错误:CMake Error at Plugins/PluginCommandInterfaceCAPI/cmake/CommonAPI.cmake:352 (message):
| Failed to generate files from FIDL:
手动执行一下:
$ commonapi-generator-linux-x86 -ll verbose -sk Default -d . /data/linux/hz_rs28_bm/sources/神燃build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/audiomanager/7.0-r1/audiomanager-7.0/Plugins/PluginCommandInterfaceCAPI/fidl/CommandInterface.fidl
-bash: /data/linux/hz_rs28_bm/sources/src/build/tools/commonapi_tool/commonapi-generator/commonapi-generator-linux-x86: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
解决(需要安装32位的glibc库和32位java jre环境):
$ sudo yum install glibc.i686
$ sudo yum install java-1.8.0-openjdk.i686
$ sudo ln -s /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.i386/jre/bin/java /bin/java
$ java -version (保证是32位的java)
编译问题2(perl_5.20.0.bb的do_package报错):
错误:ERROR: objcopy failed with exit code 256 (cmd was ‘arm-poky-linux-gnueabi-objcopy’ –only-keep-debug
… generate_uudmap: File format not recognized
解决(tar在1.29版本之后需要exclude在路径的前面):
sources/meta/poky/bitbake/lib/bb/fetch2/bzr.py
tar_flags = “–exclude ‘.bzr’ –exclude ‘.bzrtags'”
修改成:
tar_flags = “–exclude=’.bzr’ –exclude=’.bzrtags'”
sources/meta/poky/bitbake/lib/bb/fetch2/cvs.py
tar_flags = “–exclude ‘CVS'”
修改成:
tar_flags = “–exclude=’CVS'”
sources/meta/poky/bitbake/游轮虚lib/bb/fetch2/repo.py
tar_flags = “–exclude ‘.repo’ –exclude ‘.git'”
修改成:
tar_flags = “–exclude=’.repo’ –exclude=’.git'”
sources/meta/poky/bitbake/lib/bb/fetch2/svn.py
tar_flags = “–exclude ‘桐颤.svn'”
修改成:
tar_flags = “–exclude=’.svn'”
sources/meta/poky/meta/recipes-devtools/quilt/quilt-0.63.inc
tar -cf – bin/ –exclude \*.in | ( cd ${D}${PTEST_PATH} &&tar -xf – )
tar -cf – compat/ –exclude \*.in | ( cd ${D}${PTEST_PATH} &&tar -xf – )
tar -cf – quilt/ –exclude \*.in | ( cd ${D}${PTEST_PATH} &&tar -xf – )
tar -cf – test/ –exclude mail.test –exclude delete.test | ( cd ${D}${PTEST_PATH} &&tar -xf – )
修改成:
tar -c –exclude=\*.in bin/ | ( cd ${D}${PTEST_PATH} &&tar -xf – )
tar -c –exclude=\*.in compat/ | ( cd ${D}${PTEST_PATH} &&tar -xf – )
tar -c –exclude=\*.in quilt/ | ( cd ${D}${PTEST_PATH} &&tar -xf – )
tar -c –exclude=mail.test –exclude=delete.test test/ | ( cd ${D}${PTEST_PATH} &&tar -xf – &&chmod 777 test)
sources/meta/poky/meta/recipes-extended/sed/sed-4.2.2/sed-add-ptest.patch
+ cd $(BUILDDIR)tar -cf – $(TESTDIR) –exclude *.o | ( cd $(DESTDIR) &&tar -xf – )
修改成:
+ cd $(BUILDDIR)tar -c –exclude=*.o $(TESTDIR) | ( cd $(DESTDIR) &&tar -xf – )
sources/meta/poky/meta/recipes-support/attr/acl.inc
tar -cf – test/ –exclude nfs | ( cd ${D}${PTEST_PATH} &&tar -xf – )
修改成:
tar -c –exclude=nfs test/ | ( cd ${D}${PTEST_PATH} &&tar -xf – )
sources/meta/poky/meta/recipes-support/attr/attr.inc
tar -cf – test/ –exclude ext | ( cd ${D}${PTEST_PATH} &&tar -xf – )
修改成:
tar -c –exclude=ext test/ | ( cd ${D}${PTEST_PATH} &&tar -xf – )
sources/meta/poky/meta/recipes-devtools/perl/perl-ptest.inc
tar -cf – * –exclude \*.o –exclude libperl.so –exclude Makefile –exclude makefile –exclude hostperl \
–exclude miniperl –exclude generate_uudmap –exclude patches | ( cd ${D}${PTEST_PATH} &&tar -xf – )
修改成:
tar -c –exclude=\*.o –exclude=libperl.so –exclude=Makefile –exclude=makefile –exclude=hostperl \
–exclude=miniperl –exclude=generate_uudmap –exclude=patches * | ( cd ${D}${PTEST_PATH} &&tar -x )
编译问题3(libunwind_1.1.bb的do_compile报错):
错误:make[1]: latex2man: Command not found
解决:
$ sudo yum install texlive-tetex
$ sudo rpm -ivh ~/latex2man-1.18-2.noarch.rpm
编译问题3(qt5-app_1.0.bb的do_compile报错):
错误(有一批类似的错误):ld: cannot find -lgtest
解决:
$ vi atc_linux/application/btate/btate.pro
equals(MY_BUILD_SYSTEM, atc) {
LIBS += -L $(DA_LIBDIR)/lib -lgtest -lpthread -lbluetoothclient -lglobalbus -lappobj -lapputils
} else {
LIBS += -L$(DA_TOP)/application/lib -L$(DA_TOP)/../../sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/atc-binarys/1.0-r0/image/usr/lib -lgtest -lpthread -lbluetoothclient -l
globalbus -lappobj -lapputils
}
$ vi atc_linux/application/gps/gps_bin.pro
equals(MY_BUILD_SYSTEM, atc) {
LIBS += -L $(DA_LIBDIR)/lib -lapputils -lglobalbus -lappobj -lgps
} else {
LIBS += -L$(DA_TOP)/application/lib -L$(DA_TOP)/../../sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/gpsd/3.10-r0/gpsd-3.10/ -lapputils -lglobalbus -lappobj -lgps
}
$ vi atc_linux/application/dvr/dvr_bin.pro
equals(MY_BUILD_SYSTEM, atc) {
LIBS += -L${DA_TOP}/lib/lib/ -ldvr -ludev -lsurface_atc -lglobalbus -lappobj -lapputils -lstorage_atc -lgps
} else {
LIBS += -L${DA_TOP}/application/lib -L$(DA_TOP)/../../sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/gpsd/3.10-r0/gpsd-3.10/ -ldvr -ludev -lsurface_atc -lglobalbus –
lappobj -lapputils -lstorage_atc -lgps
}
$ vi atc_linux/application/dvr/dvr_bin.pro
INCLUDEPATH += ${DA_TOP}/kernel/kernel-3.18/drivers/ \
../common/ \
../utils/ \
../appobj/include/ \
../globalbus/include/ \
../appcommon/include/ \
../storage_atc/ \
../dvr/gps/ \
../gps/include/ \
../gps/includeex/ \
编译问题4(makall报错):
报错:./makall: line 169: mkisofs: command not found
解决:$ sudo yum install mkisofs
编译问题5(修改ac83xx_systemd_defconfig再编译时报错):
报错:Applying patch remove-selinux-android.patch
patching file system/extras/ext4_utils/make_ext4fs.c
Hunk #1 FAILED at 62.
1 out of 1 hunk FAILED — rejects in file system/extras/ext4_utils/make_ext4fs.c
解决:
$ vi sources/meta/meta-atc/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
在里面做个假的do_patch(),bitbake会优先使用本bb文件的do_patch()函数。
do_patch(){
}
编译问题6(修改ac83xx_systemd_defconfig再编译时报错):
报错:sources/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/qtbase/5.5.0+gitAUTOINC+c619d2daac-r0/git/src/corelib/tools/qregexp.cpp:3947:1: internal compiler error: in add_stores, at var-tracking.c:6000
解决:
$ cd sources/meta/poky/meta/recipes-devtools/gcc/gcc-4.9/
$ wget http://openlinux.windriver.com/overc/sources/core2_64/gcc-4.9.2-r0.1/0062-gcc-var-tracking.c-backport-from-gcc-trunk-r212178.patch
$ vi sources/meta/poky/meta/recipes-devtools/gcc/gcc-4.9.inc
file://0058-gcc-r212171.patch \
file://0059-gcc-PR-rtl-optimization-63348.patch \
file://target-gcc-includedir.patch \
file://0062-gcc-var-tracking.c-backport-from-gcc-trunk-r212178.patch \
其实就是这个文件:
$ cat 0062-gcc-var-tracking.c-backport-from-gcc-trunk-r212178.patch
From b30ffb8097749fdb55704aa7d8307ca1a58255d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20M=C3=BCller-Klieser?= <s.mueller-klieser@phytec.de>
Date: Tue, 7 Apr 2015 16:15:11 +0200
Subject: [PATCH] gcc/var-tracking.c: backport from gcc trunk r212178
MIME-Version: 1.0
Content-Type: text/plaincharset=UTF-8
Content-Transfer-Encoding: 8bit
resolves a bug seen on cortexa8 building qt5 libraries.
2014-06-30 Joseph Myers <joseph@codesourcery.com>
* var-tracking.c (add_stores): Return instead of asserting if old
and new values for conditional store are the same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212178 138bc75d-0d04-0410-961f-82ee72b054a4
Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
---
gcc/var-tracking.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 65d8285..7c38910 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -5997,7 +5997,8 @@ add_stores (rtx loc, const_rtx expr, void *cuip)
{
cselib_val *oval = cselib_lookup (oloc, GET_MODE (oloc), 0, VOIDmode)
- gcc_assert (oval != v)
+ if (oval == v)
+ return
gcc_assert (REG_P (oloc) || MEM_P (oloc))
if (oval &&!cselib_preserved_value_p (oval))
--
1.9.1
编译问题7(修改ac83xx_systemd_defconfig再编译时报错):
报错:libevdev/1.2.2-r0/libevdev-1.2.2/test/test-main.c:24:19: fatal error: check.h: No such file or directory
解决:
$ vi meta/poky/meta/recipes-support/libevdev/libevdev_1.2.2.bb
LIC_FILES_CHKSUM = “file://COPYINGmd5=75aae0d38feea6fda97ca381cb9132eb \
file://libevdev/libevdev.hendline=21md5=7ff4f0b5113252c2f1a828e0bbad98d1″
DEPENDS += “libcheck”
SRC_URI = “ http://www.freedesktop.org/software/libevdev/ ${BP}.tar.xz”
编译问题8(修改ac83xx_systemd_defconfig再编译时报错):
报错:python报错: ‘do_rootfs’, lineno: 17, function
Exception: CalledProcessError: Command ‘[‘du’, ‘-ks’, …
解决: 没有实际问题,重新编译一次即可,可能是机器太忙导致超时,或者某个命令执行不成功。
编译问题9(preuboot编译工具问题):
报错:make: armv7a-mediatek451_001_vfp-linux-gnueabi-gcc: Command not found
解决:
$ vi atc_linux/bootloader/preuboot/Makefile
#CROSS_COMPILE :=armv7a-mediatek451_001_vfp-linux-gnueabi-
CROSS_COMPILE :=arm-poky-linux-gnueabi-
$ vi ../../atc_linux/bootloader/preuboot/driver/mmc/include/linux/list.h
#ifndef NULL
#define NULL 0
#endif
准备工作:首先,最不可思议的,是要在Linux下把QT编译一遍,因为库都是一样的,需要的就是一些Windows下的qmake、moc、uic之类的工具而已。因为QT源码很多地方不能在Windows下面交叉编译通过,虽然我改了一些代码和配置(一会儿我贴出补丁来),但我只用它编译了qtbase、qtdeclarative这两个模块和qttools模块中的一部分。
Linux下的编译可以参照我之前写的这篇文章。参考配置:
开发包:
./configure -extprefix /opt/qt/5.2.1/arm -prefix /usr -plugindir /usr/lib/qt/plugins -importdir /usr/lib/qt/imports -qmldir /usr/lib/qt/qml -make libs -xplatform linux-arm-gnueabi-g++ -opengl es2 -confirm-license -opensource -xcb -xinput2 -nomake examples -nomake tests -qt-zlib -qt-xcb -dbus -largefile -cups -no-fontconfig -glib -gtkstyle -qt-freetype -sysroot /opt/sysroot-arm -mysql_config /opt/sysroot-arm/usr/bin/mysql_config -v
运行库:
./configure -prefix /usr -plugindir /usr/lib/qt/plugins -importdir /usr/lib/qt/imports -qmldir /usr/lib/qt/qml -make libs -xplatform linux-arm-gnueabi-g++ -opengl es2 -confirm-license -opensource -xcb -xinput2 -nomake examples -nomake tests -qt-zlib -qt-xcb -dbus -largefile -cups -no-fontconfig -glib -gtkstyle -qt-freetype -sysroot /opt/sysroot-arm -mysql_config /opt/sysroot-arm/usr/bin/mysql_config -v
做完这一步,你获得两样东西,sysroot和linux下的ARM QT开发文件。sysroot是编译QT之前,用Buildroot做的开发用根目录。这两个东西都要拷贝到Windows里,因为Windows不支持符号连接谨吵,拷贝需要需要去掉这些连接,这么做:
cp [源目录] [目标目录] -Lr
第二,需要一个Windows下模拟Linux环境的东西和编译器,我用的是MSYS和MinGW,因为他们编译出来的程序比Cygwin快。在这里可以找到:http://www.mingw.org/。
第三,悔游需要Linaro ARM GCC编译器,Windows版本的。在这里可以找到:http://www.linaro.org/downloads/
第四祥前侍,需要Python,Windows版本的。在这里可以找到:https://www.python.org/downloads/
下载、安装,然后在MSYS根目录的/etc/profile里面export PATH=$PATH:[Python安装目录]
第五,需要pkg-config,Windows版本的,这个比较麻烦,需要下载以下三个文件,并提取出我们需要的东西:
http://ftp.acc.umu.se/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip
(提取pkg-config.exe)
http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip
(提取libglib-2.0-0.dll)
http://ftp.acc.umu.se/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip (提取intl.dll)
把他们都放到MSYS的bin目录下,然后给pkg-config.exe做一个脚本pkg-config,因为下载的pkg-config.exe比较蠢,在同时指定PKG_CONFIG_SYSROOT_DIR和PKG_CONFIG_LIBDIR这两个环境变量的时候,第一个cflags会输出两次PKG_CONFIG_SYSROOT_DIR。这么做这个脚本:
#!/bin/sh
pushd / >/dev/null
ROOTDIR=`pwd -W 2>/dev/null`
popd >/dev/null
SYSROOT=$PKG_CONFIG_SYSROOT_DIR
pkg-config.exe "$@" | sed "s#$SYSROOT$SYSROOT#$SYSROOT#g" | sed "s#$ROOTDIR##g"
最后去掉$ROOTDIR前缀是为了和Linux Makefile兼容,同时也不会影响在make中的地址转换,最后,QT源码和我的补丁。
我的补丁如下:
diff -Naur qt-everywhere-opensource-src-5.2.1-old/qtbase/configure qt-everywhere-opensource-src-5.2.1/qtbase/configure
--- qt-everywhere-opensource-src-5.2.1-old/qtbase/configure 2014-02-02 04:37:23 +0800
+++ qt-everywhere-opensource-src-5.2.1/qtbase/configure 2014-08-27 22:34:47 +0800
@@ -4022,6 +4022,10 @@
done
(cd "$outpath/qmake""$MAKE") || exit 2
+if [ -e "$outpath/bin/qmake.exe" ]then
+ echo '#!/bin/sh' >"$outpath/bin/qmake"
+ echo "$outpath/bin/qmake.exe" '"$@"' "-unix" >>"$outpath/bin/qmake"
+fi
fi # Build qmake
echo "Running configuration tests..."
@@ -4091,9 +4095,9 @@
# when xcompiling, check environment to see if it's actually usable
if [ -z "$PKG_CONFIG_LIBDIR" ]then
if [ -n "$CFG_SYSROOT" ] &&[ -d "$CFG_SYSROOT/usr/lib/pkgconfig" ]then
-PKG_CONFIG_LIBDIR=$CFG_SYSROOT/usr/lib/pkgconfig:$CFG_SYSROOT/usr/share/pkgconfig
+PKG_CONFIG_LIBDIR=$CFG_SYSROOT/usr/lib/pkgconfig\$CFG_SYSROOT/usr/share/pkgconfig
if [ -n "$GCC_MACHINE_DUMP" ]then
-PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR:$CFG_SYSROOT/usr/lib/$GCC_MACHINE_DUMP/pkgconfig
+PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR\$CFG_SYSROOT/usr/lib/$GCC_MACHINE_DUMP/pkgconfig
fi
export PKG_CONFIG_LIBDIR
echo >&2 "Note: PKG_CONFIG_LIBDIR automatically set to $PKG_CONFIG_LIBDIR"
diff -Naur qt-everywhere-opensource-src-5.2.1-old/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
--- qt-everywhere-opensource-src-5.2.1-old/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf 2014-02-02 04:37:37 +0800
+++ qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf 2014-08-28 00:08:34 +0800
@@ -11,14 +11,21 @@
include(../common/g++-unix.conf)
# modifications to g++.conf
-QMAKE_CC= arm-linux-gnueabi-gcc
-QMAKE_CXX = arm-linux-gnueabi-g++
-QMAKE_LINK = arm-linux-gnueabi-g++
-QMAKE_LINK_SHLIB= arm-linux-gnueabi-g++
+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-gnueabi-ar cqs
-QMAKE_OBJCOPY = arm-linux-gnueabi-objcopy
-QMAKE_NM= arm-linux-gnueabi-nm -P
-QMAKE_STRIP = arm-linux-gnueabi-strip
+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
+
+# support for OpenGL
+QMAKE_LIBS_EGL = -lEGL
+QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM
+QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
+#QMAKE_LIBS +=
+
load(qt_config)
diff -Naur qt-everywhere-opensource-src-5.2.1-old/qtbase/qmake/generators/makefile.cpp qt-everywhere-opensource-src-5.2.1/qtbase/qmake/generators/makefile.cpp
--- qt-everywhere-opensource-src-5.2.1-old/qtbase/qmake/generators/makefile.cpp 2014-02-02 04:37:29 +0800
+++ qt-everywhere-opensource-src-5.2.1/qtbase/qmake/generators/makefile.cpp 2014-08-26 13:53:15 +0800
@@ -1161,8 +1161,8 @@
QString srcf = (*sit).toQString()
QString dstf = (*oit).toQString()
-t <<escapeDependencyPath(dstf) <<": " <<escapeDependencyPath(srcf)
- <<" " <<escapeDependencyPaths(findDependencies(srcf)).join(" \\\n\t\t")
+t <<escapeDependencyPath(dstf).replace(QRegExp("\\\\"), "/") <<": " <<escapeDependencyPath(srcf).replace(QRegExp("\\\\"), "/")
+ <<" " <<escapeDependencyPaths(findDependencies(srcf)).replaceInStrings(QRegExp("\\\\"), "/").join(" \\\n\t\t")
ProKey comp, cimp
for(QStringList::Iterator cppit = Option::cpp_ext.begin()cppit != Option::cpp_ext.end()++cppit) {
@@ -3346,6 +3346,8 @@
QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QString &src, const QString &dst)
{
QString ret
+ QString src_p = src
+ QString dst_p = dst
if (project->isEmpty(replace_rule)
|| project->isActiveConfig("no_sed_meta_install")) {
ret += "-$(INSTALL_FILE) \"" + src + "\" \"" + dst + "\""
@@ -3362,7 +3364,7 @@
+ "," + windowsifyPath(replace.toQString()) + ",gi")
}
}
-ret += " \"" + src + "\" >\"" + dst + "\""
+ret += " \"" + src_p.replace(QRegExp("\\\\"), "/") + "\" >\"" + dst_p.replace(QRegExp("\\\\"), "/") + "\""
}
return ret
}
struct TermChain {
TermChain(PatternTerm term)
diff -Naur qt-everywhere-opensource-src-5.2.1-old/qttools/src/linguist/lrelease/lrelease.pro qt-everywhere-opensource-src-5.2.1/qttools/src/linguist/lrelease/lrelease.pro
--- qt-everywhere-opensource-src-5.2.1-old/qttools/src/linguist/lrelease/lrelease.pro 2014-02-02 04:37:57 +0800
+++ qt-everywhere-opensource-src-5.2.1/qttools/src/linguist/lrelease/lrelease.pro 2014-08-28 10:42:55 +0800
@@ -1,4 +1,7 @@
option(host_build)
+
+win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
+
QT = core-private
DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
diff -Naur qt-everywhere-opensource-src-5.2.1-old/qttools/src/linguist/lupdate/lupdate.pro qt-everywhere-opensource-src-5.2.1/qttools/src/linguist/lupdate/lupdate.pro
--- qt-everywhere-opensource-src-5.2.1-old/qttools/src/linguist/lupdate/lupdate.pro 2014-02-02 04:37:57 +0800
+++ qt-everywhere-opensource-src-5.2.1/qttools/src/linguist/lupdate/lupdate.pro 2014-08-28 10:46:59 +0800
@@ -1,4 +1,7 @@
option(host_build)
+
+win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
+
QT = core-private
qtHaveModule(qmldevtools-private) {
接下来开始配置:
其中-extprefix定义安装位置,在编译完以后可以改,一会儿说;-prefix、-plugindir、-importdir、-qmldir定义的位置是目标板上的位置,加双斜杠是为了防止MSYS翻译这些路径成MSYS的路径,其他的设定与Linux下的编译没有不同。Linux下编译的sysroot可以拷贝到例如:E:/MinGW/opt/sysroot-arm。
然后编译
make module-qtbase
make module-qtdeclarative
cd qttools/src/linguist
../../../qtbase/bin/qmake.exe -unix linguist.pro
make
编译的时候可能会有几个库有链接错误,找不到一大堆gl、egl打头的函数,这是因为相应的Makefile里面的LIBS没有自动加上-lEGL -lGLES_CM -lGLESv2;但是正式使用qmake的时候不会,很奇怪;因为也就几个地方,出问题了手工加一下吧,我没去查原因改代码。
编译linguist的时候可能会遇到这个问题:http://qt-project.org/forums/viewthread/33370,按里面说的处理。
编译完了以后,把下列文件拷贝到Linux下编译的ARM QT开发包的bin目录中去:
然后,删掉对应的ARM QT开发包的bin目录中没有exe后缀的文件,那些是Linux下的。
最后一步,确保安装路径正确,也就是说,如果配置Windows下QT的时候设定-extprefix E:/MinGW/opt/qt/5.2.1/arm,那就要把替换过exe文件的ARM QT开发包放到这个位置,如果路径改了,可以用二进制搜索工具去qmake.exe中替换这个字串。
补充一下关于调试的问题,其实不是很关键。
在使用Debug模式编译的时候,最后会出现如下提示:
warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration
of GDB. Attempting to continue with the default i386 settings.
这是因为在mkspecs/features/unix/gdb_dwarf_index.prf中,有这样一段:
QMAKE_GDB_INDEX += \
test \$\$(gdb --version | sed -e \'s,[^0-9][^0-9]*\\([0-9]\\)\\.\\([0-9]\\).*,\\1\\2,q\') -gt 72 &&\
gdb --nx --batch --quiet -ex \'set confirm off\' -ex \"save gdb-index $$QMAKE_GDB_DIR\" -ex quit \'$(TARGET)\' &&\
test -f $(TARGET).gdb-index &&\
$$QMAKE_OBJCOPY --add-section \'.gdb_index=$(TARGET).gdb-index\' --set-section-flags \'.gdb_index=readonly\' \'$(TARGET)\' \'$(TARGET)\' &&\
$$QMAKE_DEL_FILE $(TARGET).gdb-index || true
很显然,这段代码把调试用的GDB默认为“gdb”了,所以应该改成你用的gdb,比如arm-linux-gnueabihf-gdb。另外,这里的sed对GDB版本的判断,无法识别像“GNU gdb (Sourcery CodeBench Lite 2014.05-29) 7.7.50.20140217-cvs”这样的版本信息的,只能识别像“GNU gdb (GDB) 7.6.1”这样的版本信息,所以你有可能看不到刚才那段提示。想解决,要么重新写一段sed的正则表达式,要么直接就把这个test ... -gt 72删掉。
设置正则表达式.类似下面的
QRegExp
这里的用法就是用来检测QString等字符串错误的,例如文件名里面最好就不出现<>|/\:等,所以可以如下定义QRegExp rx("[a-zA-Z0-9\-\\\_]{25}")25就是所输入的字符串个数!a-z当然就是a-z,你也可以abcdefghijklm....等等.\- 就是-
好了,现在可以把这个rx绑入QRegExpValidator.
QRegExpValidator *pRevalidotor = new QRegExpValidator(regExp, this)
绑入lineEdit :
pEditWell->setValidator(new QRegExpValidator(regExp, this))
常用的:
"^\d+$"//非负整数(正整数 + 0) <br>
"^[0-9]*[1-9][0-9]*$"//正整数 <br>
"^((-\d+)|(0+))$"//非正整数(负整数亩州 + 0) <br>
"^-[0-9]*[1-9][0-9]*$"//负整数 <br>
"^-?\d+$"//整数 <br>
"^\d+(\.\d+)?$"//非负浮点数(正浮点数 + 0) <br>
"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$"//正浮点数 <br>
"^((-\d+(\.\d+)?)|(0+(\.0+)?))$"//非正浮点数(负浮点数 + 0) <br>
"^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"//负浮点数 <br>
"^(-?\d+)(\.\d+)?$"//浮点数 <br>
"^[A-Za-z]+$"//由26个英文字母组成的字符串 <br>
"^[A-Z]+$"//由26个英文字母的大写组成的字符串 <br>
"^[a-z]+$"//由26个英文字母的小写组成的字符串 <br>
"^[A-Za-z0-9]+$"//由数字和26个英文字母组成的字符串 <br>
"^\w+$"//由数字、26个英文字母或者下划线组成轿耐型的字符串 <br>
"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"//email地址 <br>
"^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$"//url <br>
"^(d{2}|d{4})-((0([1-9]{1}))|(1[1|2]))-(([0-2]([1-9]{1}))|(3[0|1]))$" // 年-月-日 <br>
"^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$" // 月/日/年 <br>
"^([w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$"//Email <br>
"(d+-)?(d{4}-?d{7}|d{3}-?d{8}|^d{7,8})(-d+)?" //电话号码 <br>
"^(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5])$"
//IP地址</font></p>
<p><font size="3" color="#ff9900">^([0-9A-F]{2})(-[0-9A-F]{2}){5}$//MAC地址的正则表达式 <br>
^[-+]?\d+(\.\d+)?$ //值类型正则表达式</font></p>
</font><br>
<br>
<font size="3">QRegExp是Qt的正则表达式类.<br>
Qt中有两个不同类的正则表达式.<br>
第一类为元字符.它表示一个或多个常量表达式.<br>
令一类为 转义字符,它代表一个特殊字符.<br>
<br>
一.元字符<br>
. 匹配任意单个字符.例如, 1.3 可能是1. 后面跟任意字符,再跟3<br>
^ 匹配字符串首. 例如, ^12可能是123,但不能是312<br>
$ 配字符串尾. 例如, 12$可以是312, 当不能是 123<br>
[] 匹配括号内输入的任意字符.[123]可以为1, 2 或3<br>
* 匹配任意数量的前导字符. 例如, 1*2可以闭猜为任意数量个1(甚至没有), 后面跟一个2<br>
+ 匹配至少一个前导字符. 例如, 1+2必须为一个或多个1, 后跟一个2<br>
? 匹配一个前导字符或为空. 例如 1?2可以为2或这12<br>
<br>
二.统配模式<br>
通过 QRegExp::setPatternSyntax(QRegExp::Wildcard)可以将元字符设置为统配模式.在统配模式下,只有3个元字 符可以使用.他们的功能没有变化.<br>
? 匹配任意单个字符, 例如, 1?2可以为1,后面跟任意单个字符, 再跟2<br>
* 匹配任意一个字符序列. 例如, 1*2, 可以为1, 后面跟任意数量的字符, 再跟一个2<br>
[] 匹配一个定义的字符集合. 例如, [a-zA-Z\.]可以匹配 a到z之间任意一个字符和. [^a]匹配出小写a以外的字符.<br>
<br>
三.转义序列<br>
\. 匹配"."<br>
\^ 匹配"^"<br>
\$ 匹配"$"<br>
\[ 匹配"["<br>
\] 匹配"]"<br>
\* 匹配"*"<br>
\+ 匹配"+"<br>
\? 匹配"?"<br>
\b 匹配响铃字符,使计算机发出嘟的一声.<br>
\t 制表符号<br>
\n 换行符号<br>
\r 回车符铪<br>
\s 任意空格<br>
\xnn 匹配16进制为nn的字符<br>
\0nn 匹配8进制的nn字符<br>
这些表达式均以\开始, 与C++的转义字符相同,所以为了定义QRegExp中的一个转义序列,<br>
需要在前面添加两个\\
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)