宿主机 : 虚拟机 Ubuntu 16.04 LTS / X64
目标板[底板]: Tiny4412SDK - 1506
目标板[核心板]: Tiny4412 - 1412
LINUX内核: 4.12.0
交叉编译器: arm-none-linux-gnueabi-gcc(gcc version 4.8.3 20140320)
日期: 2017-9-16 09:59:02
作者: SY
QT
是奇趣公司开发的基于 C++
语言的 GUI
框架,具有良好的跨平台特性。在 Windows
开发调试好的程序,重新编译后在 Linux
上就可以运行。
我们将 QT
源码使用交叉编译器重新编译后,烧录到开发板中,就可以运行 QT
程序了!
我们需要从 Qt Downloads 下载 5.7
版本的源码:qt-everywhere-opensource-src-5.7.0.tar.xz
,为什么选择 5.7
版本的软件呢?因为 5.7
版本以后,将不再支持 Windows XP
,为了保持兼容性才选择这个版本。
root@ubuntu:/opt/Qt5.7.0/qt-everywhere-opensource-src-5.7.0# apt-get install g++-multilib libx11-dev libxext-dev libxtst-dev zlib1g-dev lib32ncurses5 lib32z1 libpng-dev autoconf automake libtool lsb-core
root@ubuntu:/opt/Qt5.7.0/qt-everywhere-opensource-src-5.7.0# apt-get install build-essential libfontconfig1 libfontconfig1-dev libxrender-dev libxrender1 libxkbcommon-dev libxkbcommon-x11-0 libxkbcommon-x11-dev libxkbcommon0 libglib2.0-dev libglib2.0-0 libfreetype6 libfreetype6-dev
root@ubuntu:/opt/Qt5.7.0/qt-everywhere-opensource-src-5.7.0# apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgconf2-dev libdbus-1-dev libedbus-dev
解压文件
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
qt-everywhere-opensource-src-5.7.0.tar.xz
root@ubuntu:/opt/fs/qt/qt5.7.0# tar xf qt-everywhere-opensource-src-5.7.0.tar.xz
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
qt-everywhere-opensource-src-5.7.0
root@ubuntu:/opt/fs/qt/qt5.7.0# cd qt-everywhere-opensource-src-5.7.0/
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0# ls
coin LICENSE.LGPLv3 qtconnectivity qtmultimedia qtserialport qtwebview
configure LICENSE.PREVIEW.COMMERCIAL qtdatavis3d qt.pro qtsvg qtwinextras
configure.bat Makefile qtdeclarative qtpurchasing qttools qtx11extras
gnuwin32 qt3d qtdoc qtquickcontrols qttranslations qtxmlpatterns
LGPL_EXCEPTION.txt qtactiveqt qtgamepad qtquickcontrols2 qtvirtualkeyboard README
LICENSE.FDL qtandroidextras qtgraphicaleffects qtscript qtwayland
LICENSE.GPLv2 qtbase qtimageformats qtscxml qtwebchannel
LICENSE.GPLv3 qtcanvas3d qtlocation qtsensors qtwebengine
LICENSE.LGPLv21 qtcharts qtmacextras qtserialbus qtwebsockets
root@ubuntu:/opt/Qt5.7.0/qt-everywhere-opensource-src-5.7.0# mkdir /usr/local/Qt5.7.0
修改配置文件
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0# 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
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7-a -mtune=cortex-a9
QMAKE_CXXFLAGS += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7-a -mtune=cortex-a9
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = arm-none-linux-gnueabi-gcc -lts
QMAKE_CXX = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++ -lts
# modifications to linux.conf
QMAKE_AR = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy
QMAKE_NM = arm-none-linux-gnueabi-nm -P
QMAKE_STRIP = arm-none-linux-gnueabi-strip
load(qt_config)
建立安装目录
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0/qtbase/mkspecs/linux-arm-gnueabi-g++# mkdir -p /usr/local/Qt5.7.0
建立一个 configurate
脚本
#!/bin/bash
#################################################
# Developer: SY
# Data : 2017-9-16 10:26:13
# Function : Auto Configure Project
#################################################
./configure -prefix /usr/local/Qt5.7.0 \
-opensource \
-release \
-confirm-license \
-xplatform linux-arm-gnueabi-g++ \
-shared \
-qt-zlib \
-no-gif \
-qt-libjpeg \
-no-nis \
-no-opengl \
-no-cups \
-no-glib \
-no-dbus \
-no-rpath \
-no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \
-no-avx \
-no-openssl \
-nomake tools \
-qreal float \
-qt-libpng \
-tslib \
-skip qtdeclarative \
-nomake examples \
-I /usr/local/tslib/include \
-L /usr/local/tslib/lib \
echo "done!"
-mtdev
-xinput2
,但是添加会出错。执行脚本
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0# ./auto_configurate.sh
...
Build options:
Configuration .......... accessibility audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile doubleconversion evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz iconv inotify ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap no-gif no-pkg-config pcre png poll_ppoll posix_fallocate qpa qpa reduce_exports release shared small-config threadsafe-cloexec tslib zlib
Build parts ............ libs
Mode ................... release
Using sanitizer(s)...... none
Using C++ standard ..... c++11
Using gold linker....... no
Using new DTAGS ........ no
Using PCH .............. no
Using LTCG ............. no
Target compiler supports:
Neon ................. no
Qt modules and options:
Qt D-Bus ............... no
Qt Concurrent .......... yes
Qt GUI ................. yes
Qt Widgets ............. yes
Large File ............. yes
QML debugging .......... yes
Use system proxies ..... no
Support enabled for:
Accessibility .......... yes
ALSA ................... no
CUPS ................... no
DoubleConversion........ yes (bundled copy)
Evdev .................. yes
FontConfig ............. no
FreeType ............... yes (bundled copy)
Glib ................... no
GStreamer .............. no
GTK platformtheme ...... no
HarfBuzz ............... yes (bundled copy)
Iconv .................. yes
ICU .................... no
Image formats:
GIF .................. no
JPEG ................. yes (plugin, using bundled copy)
PNG .................. yes (in QtGui, using bundled copy)
libinput................ no
Logging backends:
journald ............... no
syslog ............... no
mtdev .................. no
Networking:
getaddrinfo .......... yes
getifaddrs ........... yes
IPv6 ifname .......... yes
libproxy.............. no
OpenSSL .............. no
NIS .................... no
OpenGL / OpenVG:
EGL .................. no
OpenGL ............... no
OpenVG ............... no
PCRE ................... yes (bundled copy)
pkg-config ............. no
PulseAudio ............. no
QPA backends:
DirectFB ............. no
EGLFS ................ no
EGLFS i.MX6 ........ no
EGLFS i.MX6 Wayland. no
EGLFS EGLDevice .... no
EGLFS GBM .......... no
EGLFS Mali ......... no
EGLFS Raspberry Pi . no
EGLFS X11 .......... no
LinuxFB .............. yes
Mir client............ no
XCB .................. no
Session management ..... yes
SQL drivers:
DB2 .................. no
InterBase ............ no
MySQL ................ no
OCI .................. no
ODBC ................. no
PostgreSQL ........... no
SQLite 2 ............. no
SQLite ............... yes (plugin, using bundled copy)
TDS .................. no
tslib .................. yes
udev ................... no
xkbcommon-x11........... no
xkbcommon-evdev......... no
zlib ................... yes (bundled copy)
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Qt5.7.0
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
done!
注意,在脚本中有一个很重要配置:-skip qtdeclarative \
,如果不加上这一句,在编译时出现错误:
Project MESSAGE: Hunspell not found! Spell correction will not be available.
Project ERROR: Unknown module(s) in QT: quick
Makefile:44: recipe for target 'sub-virtualkeyboard-make_first' failed
make[2]: *** [sub-virtualkeyboard-make_first] Error 3
参考网上帖子:How to install and build Qt5.7-everywhere for beaglebone black- OS debian?
安装各种库,参考:qtbase/src/plugins/platforms/xcb/README
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0/ apt-get install libncurses5-dev libreadline-dev libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev libxcb-xinerama0-dev
然后执行:make -j4
然后执行:make install
,安装文件被安装到路径:/usr/local/Qt5.7.0
root@ubuntu:/home/sy# cd /usr/local/Qt5.7.0/
root@ubuntu:/usr/local/Qt5.7.0# ls
bin doc include lib mkspecs plugins translations
root@ubuntu:/usr/local/Qt5.7.0# cd bin/
root@ubuntu:/usr/local/Qt5.7.0/bin# ls
canbusutil lconvert lupdate qdoc qmake qtpaths rcc uic xmlpatternsvalidator
fixqt4headers.pl lrelease moc qlalr qtdiag qtplugininfo syncqt.pl xmlpatterns
其中:qmake
就是用于自动生成 Makefile
的工具,以后编译 qt
工程的时候会经常遇到。
生成 Makefile
root@ubuntu:/opt/fs/rootfs/rootfs/tmp/GDB# /usr/local/Qt5.7.0/bin/qmake GDB.pro
Info: creating stash file /opt/fs/rootfs/rootfs/tmp/GDB/.qmake.stash
root@ubuntu:/opt/fs/rootfs/rootfs/tmp/GDB# ls
app.ico crc16.h GDB.pro.user.4b6dd04 mainwindow.h RES UAC.rc xml.cpp
config GDB.pro main.cpp mainwindow.ui res.qrc utils.cpp xml.h
crc16.cpp GDB.pro.user mainwindow.cpp Makefile UAC.manifest utils.h
然后 make
root@ubuntu:/opt/fs/rootfs/rootfs/tmp/GDB# make
root@ubuntu:/opt/fs/rootfs/rootfs/tmp/GDB# ls
app.ico GDB main.o Makefile moc_xml.cpp res.qrc utils.h
config GDB.pro mainwindow.cpp moc_crc16.cpp moc_xml.o UAC.manifest utils.o
crc16.cpp GDB.pro.user mainwindow.h moc_crc16.o qrc_res.cpp UAC.rc xml.cpp
crc16.h GDB.pro.user.4b6dd04 mainwindow.o moc_mainwindow.cpp qrc_res.o ui_mainwindow.h xml.h
crc16.o main.cpp mainwindow.ui moc_mainwindow.o RES utils.cpp xml.o
生成 GDB
可执行程序,将文件拷贝到开发板就可以运行。
用上述方法可以运行 QT
官方的例程:
root@ubuntu:/# cd /opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0/qtbase/examples/
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0/qtbase/examples# ls
aggregate dbus examples.pro Makefile opengl qpa qtestlib sql widgets
corelib embedded gui network qmake qtconcurrent README touch xml
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0/qtbase/examples# /usr/local/Qt5.7.0/bin/qmake
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0/qtbase/examples# make
root@ubuntu:/opt/fs/qt/qt5.7.0/qt-everywhere-opensource-src-5.7.0/qtbase/examples# make clean
这样所有的例程全部编译完毕,烧录到 linux
中执行。
看到演示效果才发现以 linuxfb
运行的程序,全部都没有边框。没有右上角的 X
-
口
标识。
将该目录下的所有文件拷贝到开发板的根文件系统:
root@ubuntu:/usr/local/Qt5.7.0# cp -a * /opt/fs/rootfs/rootfs/usr/local/Qt5.7.0/
修改配置文件
root@ubuntu:/opt/fs/rootfs/rootfs# cat etc/profile
# /etc/profile: system-wide .profile file for the Bourne shells
echo ""
echo -n "Processing /etc/profile... "
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
HOSTNAME='/bin/hostname'
PS1='[\u@\h:\w]# '
PATH=$PATH
export USER LOGNAME PS1 PATH
# tslib
export T_ROOT=/usr/local/tslib
export LD_LIBRARY_PATH=/usr/local/tslib/lib:$LD_LIBRARY_PATH
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
export POINTERCAL_FILE=/etc/pointercal
export TSLIB_CALIBFILE=/etc/pointercal
# Qt
export QTEDIR=/usr/local/Qt5.7.0
export LD_LIBRARY_PATH=/usr/local/Qt5.7.0/lib:$LD_LIBRARY_PATH
export QT_QPA_GENERIC_PLUGINS=tslib
export QT_QPA_FONTDIR=$QTEDIR/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTEDIR/plugins
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x480:mmSize=800x480:offset=0x0:tty=/dev/tty1
export QT_QPA_FB_TSLIB=1
export QT_QPA_FB_HIDECURSOR=/dev/input/mouse1
export LD_PRELOAD=$QTEDIR/lib/preloadable_libiconv.so
echo "Done!"
从友善之臂的光盘中拷贝字体:DroidSansFallback.ttf
放到开发板路径:/usr/local/Qt5.7.0/lib/fonts
添加字体路径:
[root@TINY4412:~]# vi etc/profile
export QTEDIR=/usr/local/Qt5.7.0
export QT_QPA_FONTDIR=$QTEDIR/lib/fonts
参考Qt for Embedded Linux Environment Variables
将键盘插入开发板
[root@TINY4412:~]# [ 356.181581] usb 2-2.3: new low-speed USB device number 5 using exynos-ehci
[ 356.338068] usb 2-2.3: New USB device found, idVendor=1c4f, idProduct=0002
[ 356.338218] usb 2-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 356.338358] usb 2-2.3: Product: USB Keyboard
[ 356.338454] usb 2-2.3: Manufacturer: SIGMACHIP
[ 356.349473] input: SIGMACHIP USB Keyboard as /devices/platform/12580000.ehci/usb2/2-2/2-2.3/2-2.3:1.0/0003:1C4F:0002.0001/input/input4
[ 356.415871] hid-generic 0003:1C4F:0002.0001: input: USB HID v1.10 Keyboard [SIGMACHIP USB Keyboard] on usb-12580000.ehci-2.3/input0
[ 356.454307] input: SIGMACHIP USB Keyboard as /devices/platform/12580000.ehci/usb2/2-2/2-2.3/2-2.3:1.1/0003:1C4F:0002.0002/input/input5
[ 356.522293] hid-generic 0003:1C4F:0002.0002: input: USB HID v1.10 Device [SIGMACHIP USB Keyboard] on usb-12580000.ehci-2.3/input1
查看 proc
[root@TINY4412:~]# cat /proc/bus/input/devices
I: Bus=0003 Vendor=1c4f Product=0002 Version=0110
N: Name="SIGMACHIP USB Keyboard"
P: Phys=usb-12580000.ehci-2.3/input0
S: Sysfs=/devices/platform/12580000.ehci/usb2/2-2/2-2.3/2-2.3:1.0/0003:1C4F:0002.0001/input/input4
U: Uniq=
H: Handlers=sysrq kbd leds event4
B: PROP=0
B: EV=120013
B: KEY=10000 7 ff800000 7ff febeffdf f3cfffff ffffffff fffffffe
B: MSC=10
B: LED=7
I: Bus=0003 Vendor=1c4f Product=0002 Version=0110
N: Name="SIGMACHIP USB Keyboard"
P: Phys=usb-12580000.ehci-2.3/input1
S: Sysfs=/devices/platform/12580000.ehci/usb2/2-2/2-2.3/2-2.3:1.1/0003:1C4F:0002.0002/input/input5
U: Uniq=
H: Handlers=kbd event5
B: PROP=0
B: EV=1f
B: KEY=3007f 0 0 0 0 483ffff 17aff32d bf544446 0 0 1 130c13 b17c000 267bfa d941dfed 9e1680 4400 0 10000002
B: REL=40
B: ABS=1 0
B: MSC=10
鼠标含有 2
个接口,因此识别为 dev/input/event4
dev/input/event5
按照 qt
的说明文档,需要添加 QWS_KEYBOARD
环境变量
export QWS_KEYBOARD=/dev/input/event4
但是实测插上键盘后直接可以输入数据,不添加环境变量也可以。
将鼠标插入开发板
[root@TINY4412:~]# [ 1016.121660] usb 2-2.3: new low-speed USB device number 13 using exynos-ehci
[ 1016.276005] usb 2-2.3: New USB device found, idVendor=275d, idProduct=0ba6
[ 1016.276198] usb 2-2.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 1016.276364] usb 2-2.3: Product: USB OPTICAL MOUSE
[ 1016.288896] input: USB OPTICAL MOUSE as /devices/platform/12580000.ehci/usb2/2-2/2-2.3/2-2.3:1.0/0003:275D:0BA6.000F/input/input18
[ 1016.292002] hid-generic 0003:275D:0BA6.000F: input: USB HID v1.11 Mouse [USB OPTICAL MOUSE ] on usb-12580000.ehci-2.3/input0
查看 proc
[root@TINY4412:~]# cat /proc/bus/input/devices
I: Bus=0003 Vendor=275d Product=0ba6 Version=0111
N: Name="USB OPTICAL MOUSE "
P: Phys=usb-12580000.ehci-2.3/input0
S: Sysfs=/devices/platform/12580000.ehci/usb2/2-2/2-2.3/2-2.3:1.0/0003:275D:0BA6.000F/input/input18
U: Uniq=
H: Handlers=mouse1 event6
B: PROP=0
B: EV=17
B: KEY=70000 0 0 0 0 0 0 0 0
B: REL=103
B: MSC=10
鼠标被识别为 dev/input/mouse1
[root@TINY4412:~]# vi /etc/profile
export QT_QPA_FB_HIDECURSOR=/dev/input/mouse1
[root@TINY4412:~]# vi etc/profile
export QT_QPA_FB_TSLIB=1
下载 qtvirtualkeyboard-opensource-src-5.7.0.tar.xz 源码,
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
qt-everywhere-opensource-src-5.7.0 qtvirtualkeyboard-opensource-src-5.7.0.tar.xz
root@ubuntu:/opt/fs/qt/qt5.7.0# tar xf qtvirtualkeyboard-opensource-src-5.7.0.tar.xz
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
qt-everywhere-opensource-src-5.7.0 qtvirtualkeyboard-opensource-src-5.7.0.tar.xz
qtvirtualkeyboard-opensource-src-5.7.0
root@ubuntu:/opt/fs/qt/qt5.7.0# rm -rf qtvirtualkeyboard-opensource-src-5.7.0.tar.xz
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
qt-everywhere-opensource-src-5.7.0 qtvirtualkeyboard-opensource-src-5.7.0
root@ubuntu:/opt/fs/qt/qt5.7.0# cd qtvirtualkeyboard-opensource-src-5.7.0/
root@ubuntu:/opt/fs/qt/qt5.7.0/qtvirtualkeyboard-opensource-src-5.7.0# ls
dist examples LICENSE.GPL3 Makefile mkspecs qtvirtualkeyboard.pro README.md src sync.profile tests
配置支持拼音输入法
root@ubuntu:/opt/fs/qt/qt5.7.0/qtvirtualkeyboard-opensource-src-5.7.0# /usr/local/Qt5.7.0/bin/qmake CONFIG+="lang-en_GB lang-zh_CN"
编译
root@ubuntu:/opt/fs/qt/qt5.7.0/qtvirtualkeyboard-opensource-src-5.7.0# make
cd src/ && ( test -e Makefile || /usr/local/Qt5.7.0/bin/qmake /opt/fs/qt/qt5.7.0/qtvirtualkeyboard-opensource-src-5.7.0/src/src.pro -o Makefile ) && make -f Makefile
make[1]: Entering directory '/opt/fs/qt/qt5.7.0/qtvirtualkeyboard-opensource-src-5.7.0/src'
cd virtualkeyboard/ && ( test -e Makefile || /usr/local/Qt5.7.0/bin/qmake /opt/fs/qt/qt5.7.0/qtvirtualkeyboard-opensource-src-5.7.0/src/virtualkeyboard/virtualkeyboard.pro '+=lang-en_GB lang-zh_CN' -o Makefile ) && make -f Makefile
(command line): Assignment needs exactly one word on the left hand side.
Project MESSAGE: Hunspell not found! Spell correction will not be available.
Project ERROR: Unknown module(s) in QT: qml quick
Makefile:44: recipe for target 'sub-virtualkeyboard-make_first' failed
make[1]: *** [sub-virtualkeyboard-make_first] Error 3
make[1]: Leaving directory '/opt/fs/qt/qt5.7.0/qtvirtualkeyboard-opensource-src-5.7.0/src'
Makefile:44: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2
这个问题在编译 qt
时就出现,一直没找到解决方案,留着以后解决。
运行官方例程:
[root@TINY4412:/opt/examples]# ./touch/pinchzoom/pinchzoom
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
参考:qt5.2.0 交叉编译 跑到arm板上,中/英字符都显示不出来 ,下载:libiconv-1.14.tar.gz
出现错误:iconv_open failed
c
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
libiconv-1.14.tar.gz qt-everywhere-opensource-src-5.7.0 qtvirtualkeyboard-opensource-src-5.7.0
root@ubuntu:/opt/fs/qt/qt5.7.0# tar zxf libiconv-1.14.tar.gz
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
libiconv-1.14 libiconv-1.14.tar.gz qt-everywhere-opensource-src-5.7.0 qtvirtualkeyboard-opensource-src-5.7.0
root@ubuntu:/opt/fs/qt/qt5.7.0# rm -rf libiconv-1.14.tar.gz
root@ubuntu:/opt/fs/qt/qt5.7.0# ls
libiconv-1.14 qt-everywhere-opensource-src-5.7.0 qtvirtualkeyboard-opensource-src-5.7.0
root@ubuntu:/opt/fs/qt/qt5.7.0# cd libiconv-1.14/
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14# ls
ABOUT-NLS ChangeLog COPYING.LIB extras lib man PORTS src tools
aclocal.m4 config.h.in DEPENDENCIES gnulib-local libcharset NEWS preload srclib windows
AUTHORS configure DESIGN HACKING m4 NOTES README srcm4 woe32dll
autogen.sh configure.ac djgpp include Makefile.devel os2 README.djgpp tests
build-aux COPYING doc INSTALL.generic Makefile.in po README.woe32 THANKS
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14# ./configure -prefix=$PWD/_install -host=arm-none-linux-gnueabi
...
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14# make
出现错误:
In file included from progname.c:26:0:
./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^
Makefile:914: recipe for target 'progname.o' failed
make[2]: *** [progname.o] Error 1
make[2]: Leaving directory '/opt/fs/qt/qt5.7.0/libiconv-1.14/srclib'
Makefile:865: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/opt/fs/qt/qt5.7.0/libiconv-1.14/srclib'
Makefile:33: recipe for target 'all' failed
make: *** [all] Error 2
解决编译libiconv时报错:./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
做如下修改:
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14# vim srclib/stdio.in.h
694 _GL_CXXALIASWARN (gets);
695 /* It is very rare that the developer ever has full control of stdin,
696 so any use of gets warrants an unconditional warning. Assume it is
697 always declared, since it is required by C89. */
698 /* _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); */
699 #if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
700 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
701 #endif
编译成功!
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14# make install
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14# cd _install/
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14/_install# ls
bin include lib share
拷贝库到开发板
root@ubuntu:/opt/fs/qt/qt5.7.0/libiconv-1.14/_install# cp lib/preloadable_libiconv.so /opt/fs/rootfs/rootfs/usr/local/Qt5.7.0/lib/
添加到环境变量
[root@TINY4412:~]# vi /etc/profile
export QTEDIR=/usr/local/Qt5.7.0
export LD_PRELOAD=$QTEDIR/lib/preloadable_libiconv.so
[root@TINY4412:~]# source /etc/profile
再次运行程序,错误消失!
移植QT5.6到嵌入式开发板(史上最详细的QT移植教程)
Qt-5.3.2 在友善Smart210开发板的移植记录
Qt:5.7虚拟键盘中拼音输入法的使用