打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
编译Qt5.4 for IFC6410

一、编译Qt5.4 forIFC6410

环境变量

exportQT_SYSROOT=/home/gang/IFC6410/qt-5.4-sysroot

exportMONTFOLDER=/home/gang/IFC6410/ImgMountFolder

exportQT_INSTALL_DIR=/home/gang/IFC6410/qt-5.4-for-ifc6410-installed

exportARCH=arm

exportCROSS_COMPILE=/home/gang/IFC6410/toolchain/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-

 

1.解压img

sudo apt-get installandroid-tools-fsutils

 

simg2imglinaro-trusty-gnome-ifc6410-20141024-37.imglinaro-trusty-gnome-ifc6410-20141024-37.img.raw

2.挂在至目录

mount -oloop/home/gaea/IFC6410/ifc-pre-images/IFC6410_Ubuntu_Linux_BSP_880310_V1.3/IFC6410_Ubuntu_Linux_BSP_880310_V1.3/binaries/linaro-trusty-gnome-ifc6410-20141024-37.img.raw/home/gaea/IFC6410/qt5.4-for-ifc6410/ImgMountFolder

 

3.配置qt源码配置文件

qtbase->mkspec->device->ifc-linux->qmake.conf

 

#

# qmakeconfiguration 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)

 

#CROSS_COMPILE=/home/gaea/IFC6410/qt5.4-for-ifc6410/toolchain/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/bin/arm-linux-gnueabihf-

CROSS_COMPILE=/home/gaea/IFC6410/qt5.4-for-ifc6410/toolchain/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-

QTSYSROOT=/home/gaea/IFC6410/qt5.4-for-ifc6410/qt5.4-sysroot

MONTFOLDER=/home/gaea/IFC6410/qt5.4-for-ifc6410/ImgMountFolder

 

QMAKE_INCDIR          += $$[QT_SYSROOT]/usr/include \

                      $$[QT_SYSROOT]/usr/include/arm-linux-gnueabihf\

                     /home/gaea/IFC6410/qt5.4-for-ifc6410/profiles/include

 

QMAKE_LIBDIR          += $$[QT_SYSROOT]/usr/lib \

                         $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \

                         $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \

                      $${MONTFOLDER}/lib/arm-linux-gnueabihf\

                      $${MONTFOLDER}/usr/lib/arm-linux-gnueabihf\

                     $${MONTFOLDER}/usr/lib/arm-linux-gnueabihf/mesa-egl

 

 

#QMAKE_LIBS= -lcap -lcidn -lcom_err -lc_nonshared -lm -lc -ldl -lpthread-lld-linux -lld-linux-armhf -lffi -lwayland-egl -lwayland-client-lwayland-server -ldrm -ldrm_nouveau -ldrm_freedreno -lxcb-xfixes-lxcb-dri2 -lxcb-dri3 -lXau -lX11-xcb -lXdmcp -lxcb -lX11 -lxcb-shm-lXrender -lxcb-render-util -lxcb-render -lxcb-icccm -lxcb-util-lXi -lXext -lxcb-icccm -lgbm

 

#QMAKE_LIBS+=-Wl,-rpath-link=$${MONTFOLDER}/lib/arm-linux-gnueabihf -lpng12-lharfbuzz -lz -lstdc++ -lm -lgcc_s -lld-linux-armhf -lpthread-licui18n -licuuc -ldl -lglib-2.0 -lrt -lfreetype -lgraphite2-licudata -lpcre -lffi -ldrm -ldrm_nouveau -ldrm_freedreno-lxcb-xfixes -lxcb-dri2 -lxcb-dri3 -lXau -lX11-xcb -lXdmcp -lxcb-lX11 -lxcb-shm -lXrender -lxcb-render-util -lxcb-render-lxcb-icccm -lxcb-util -lXi -lXext -lxcb-icccm -lwayland-egl-lwayland-client -lwayland-server -lgbm

 

QMAKE_LIBS+=-L$${MONTFOLDER}/usr/lib/arm-linux-gnueabihf-L$${MONTFOLDER}/lib/arm-linux-gnueabihf -dynamic-linker -lc-2.19-lXau -lXdmcp -lpthread -lxcb-dri2 \

      -lX11-xcb \

      -lxcb-xfixes \

      -lwayland-client \

      -lwayland-server \

      -lgbm \

      -ldl \

      -ldrm \

      -lld-linux-armhf \

      -lffi \

      -lrt \

      -lgcc_s \

      -lXrender \

      -lXi \

      -lXext \

      -lxcb \

      -lX11

 

 

QMAKE_INCDIR_OPENGL_ES2 =/home/gaea/IFC6410/qt5.4-for-ifc6410/profiles/include

QMAKE_LIBDIR_OPENGL_ES2 =$${MONTFOLDER}/lib/arm-linux-gnueabihf \

                     $${MONTFOLDER}/usr/lib/arm-linux-gnueabihf/mesa-egl \

                     $${MONTFOLDER}/usr/lib/arm-linux-gnueabihf

 

QMAKE_LIBS_OPENGL_ES2= -lglapi -lGLESv1_CM-lGLESv2

      

 

#modifications to g++.conf

QMAKE_CC               = $${CROSS_COMPILE}gcc

QMAKE_CXX              = $${CROSS_COMPILE}g++

QMAKE_LINK             = $${CROSS_COMPILE}g++

QMAKE_LINK_SHLIB       = $${CROSS_COMPILE}g++

 

QMAKE_CFLAGS           = -O2 -march=armv7-a -mfpu=neon -mfloat-abi=hard

QMAKE_CXXFLAGS         = $$QMAKE_CFLAGS

#modifications to linux.conf

QMAKE_AR               = $${CROSS_COMPILE}ar cqs

QMAKE_OBJCOPY          = $${CROSS_COMPILE}objcopy

QMAKE_NM               = $${CROSS_COMPILE}nm -P

QMAKE_STRIP            = $${CROSS_COMPILE}strip

load(qt_config)

 

 

 

 

 

 

#include"../../linux-g++/qplatformdefs.h"

 

 

 

 

4.检查环境变量

echo  $QT_INSTALL_DIR

echo$CROSS_COMPILE

echo$ARCH

echo$QT_SYSROOT

 

5.配置Qt源码

./configure-v --prefix=/qt5.4-for-ifc6410-installed -confirm-license -opensource -device ifc-linux -device-optionCROSS_COMPILE=/home/gaea/IFC6410/qt5.4-for-ifc6410/toolchain/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf--opengl es2 -eglfs -no-c++11 -optimized-qmake -qreal float -sysroot/home/gaea/IFC6410/qt5.4-for-ifc6410/qt5.4-sysroot -qt-xcb-no-gcc-sysroot -qt-zlib -no-dbus

 

6.提示找不到库,在${MONTFOLDER}/usr/lib/arm-linux-gnueabihf目录下创建软链接(去除版本号版本)

ls*X11

ln -sAAA.so.1.1 AAA.so

解决所有找不到库文件

找不到-lxcb-aux  -lxcb-atom   -lxcb-property  -lxcb-event   

最终添加

QMAKE_LIBS= -lcap -lcidn -lcom_err -lc_nonshared -lm -lc -ldl -lpthread-lld-linux -lld-linux-armhf -lffi -lwayland-egl -lwayland-client-lwayland-server -ldrm -ldrm_nouveau -ldrm_freedreno -lxcb-xfixes-lxcb-dri2 -lxcb-dri3 -lgbm -lXau -lX11-xcb -lXdmcp -lxcb -lX11-lxcb-shm -lXrender -lxcb-render-util -lxcb-render -lxcb-icccm-lxcb-util -lXi -lXext -lxcb-icccm

 

 

7.检查configure配置结果

make-j4

makeinstall

 问题记录

问题一:

-qt-xcb   必须依赖项 libxcb.so,按照此方式添加其他依赖库,以及修改链接名字

 1123  cdmesa-egl/

 1124  ll

 1125  ln -s libEGL.so.1libEGL.so

 1126  ln -slibGLESv1_CM.so.1.1.0 libGLESv1_CM.so

 1127  ln -slibGLESv2.so.2.0.0 libGLESv2.so

 1128  ln -slibOpenVG.so.1.0.0 libOpenVG.so

 1129  cd ..

 1130  ln -slibxcb.so.1.1.0 libxcb.so

 1131  ln -slibXau.so.6.0.0 libXau.so

 1132  ln -slibXdmcp.so.6.0.0 libXdmcp.so

 

问题二:解决方法是修改libc的依赖库,我先删除了目录下的libc文件,然后创建了toolchain中的依赖库,然后再删除toolchain中的libc.so,再添加rootfs中的libc-2.19,再修改编译参数为:

QMAKE_LIBS +=-L$${MONTFOLDER}/usr/lib/arm-linux-gnueabihf-L$${MONTFOLDER}/lib/arm-linux-gnueabihf -dynamic-linker -lc-2.19-lXau -lXdmcp -lpthread -lxcb-dri2 \

      -lX11-xcb \

      -lxcb-xfixes \

      -lwayland-client \

      -lwayland-server \

      -lgbm \

      -ldl \

      -ldrm \

      -lld-linux-armhf \

      -lffi \

      -lrt \

      -lgcc_s \

      -lXrender \

      -lXi \

      -lXext \

      -lxcb \

      -lX11

/home/gaea/IFC6410/qt5.4-for-ifc6410/toolchain/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/../arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/crt1.o:In function `_start':

:(.text+0x24): undefined reference to`__libc_csu_fini'

:(.text+0x2c): undefined reference to`__libc_csu_init'

collect2:error: ld returned 1 exit status

make: ***[opengles2] Error 1

OpenGL ES2.0 disabled.

 

编译概览

Buildoptions:

  Configuration .......... accessibilityaudio-backend clock-gettime clock-monotonic compile_examplesconcurrent cross_compile egl eglfs evdev eventfd freetypefull-config getaddrinfo getifaddrs harfbuzz iconv inotifyipv6ifname large-config largefile linuxfb medium-configminimal-config mremap neon nis no-pkg-config opengl opengles2 pcrepng posix_fallocate precompile_header qpa qpa reduce_exportsrelease rpath shared small-config use_gold_linker xcb xcb-pluginxcb-qt xkbcommon-qt zlib

  Build parts ............ libsexamples

  Mode ...................release

  Using C++11 ............ no

  Using gold linker....... yes

  Using PCH .............. yes

  Target compiler supports:

    Neon................. yes

 

Qt modulesand options:

  Qt D-Bus ............... no

  Qt Concurrent .......... yes

  Qt GUI ................. yes

  Qt Widgets ............. yes

  Large File ............. yes

  QML debugging .......... yes

  Use system proxies ..... no

 

Supportenabled for:

  Accessibility .......... yes

  ALSA ................... no

  CUPS ................... no

  Evdev .................. yes

  FontConfig ............. no

  FreeType ............... yes (bundledcopy)

  Glib ................... no

  GTK theme .............. no

  HarfBuzz ............... yes (bundledcopy)

  Iconv .................. yes

  ICU .................... no

  Image formats:

    GIF.................. yes (plugin, using bundled copy)

    JPEG................. yes (plugin, using bundled copy)

    PNG.................. yes (in QtGui, using bundled copy)

  journald ............... no

  mtdev .................. no

  Networking:

   getaddrinfo .......... yes

   getifaddrs ........... yes

    IPv6ifname .......... yes

   OpenSSL .............. no

  NIS .................... yes

  OpenGL / OpenVG:

    EGL.................. yes

   OpenGL ............... yes (OpenGL ES 2.0+)

   OpenVG ............... no

  PCRE ................... yes (bundledcopy)

  pkg-config ............. no

  PulseAudio ............. no

  QPA backends:

   DirectFB ............. no

   EGLFS ................ yes

    KMS.................. no

   LinuxFB .............. yes

    XCB.................. yes (bundled copy)

     EGL on X ........... no

     GLX ................ no

     MIT-SHM ............ yes

     Xcb-Xlib ........... no

     Xcursor ............ yes (loaded at runtime)

     Xfixes ............. yes (loaded at runtime)

     Xi ................. yes (loaded at runtime)

     Xi2 ................ no

     Xinerama ........... yes (loaded at runtime)

     Xrandr ............. yes (loaded at runtime)

     Xrender ............ no

     XKB ................ yes

     XShape ............. yes

     XSync .............. yes

     XVideo ............. yes

  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

  udev ................... no

  xkbcommon .............. yes (bundledcopy, XKB config root: /usr/share/X11/xkb)

  zlib ................... yes (bundledcopy)

 


二、IFC6410开发板环境配置

1.配置lib加载路径

sudo vi /etc/ld.so.conf

添加qt5.4 lib文件夹

sudo ldconfig生效

2.拷贝plugin/platforms路径到执行路径下(或者添加环境变量)

 

 

3.设置环境变量

export QTDIR=

export PATH=$QTDIR/bin:$PATH

export LD_LIBRARY_PATH=$QTDIR/lib

exportQWS_DISPLAY="LinuxFB:mmWidth200:0"

 

 

3.1.qt的触摸屏和指针环境变量bash文件

#!/bin/sh

 

if [ -c /dev/input/event0 ]; then

   INPUT_PATH=/dev/input

else

   INPUT_PATH=/dev

fi

 

export TSLIB_TSDEVICE=/dev/input/event1

export TSLIB_CONFFILE=/etc/ts.conf

export TSLIB_PLUGINDIR=/lib/ts

export TSLIB_CALIBFILE=/etc/pointercal

exportQTDIR=/usr/local/Trolltech/QtEmbedded-4.8.6-arm/

export PATH=$QTDIR/bin:$PATH

export LD_LIBRARY_PATH=$QTDIR/lib

exportQWS_MOUSE_PROTO="Tslib:$INPUT_PATH/event1"

#export QWS_MOUSE_PROTO="Tslib:$INPUT_PATH/event1MouseMan:$INPUT_PATH/mouse1"

export QWS_KEYBOARD=TTY:/dev/tty1

 

#sync font size with QtDesigner

exportQWS_DISPLAY="LinuxFB:mmWidth200:0"

#export QWS_SIZE="480x272"

 

export KDEDIR=/opt/kde

export HOME=/root


GDB

5.1. wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.2.tar.gz

5.2. ./configure --target=arm-linux-gnueabihf--with-python

make

sudo make installed

 

 

安装到默认位置,否则有可能找不到python

默认位置在/usr/local/bin/arm-linux-gdb

 

GDBSERVER

sudo apt-get install gdbserver

三、编写Qt程序配置

1.pro文件中添加

target.path =/home/linaro

INSTALLS +=target

2.解决中文字体乱码

拷贝一个ttf文件到qt安装目录下/lib/lonts下,并将原目录下的所有字体备份删除(保证此目录只有一个字体,否则需要程序指定使用哪一个字体)

 

QGuiApplicationapp(argc, argv);

QQuickViewview;

// Load theembedded font.

QString fontPath= ":/fonts/MyFont.ttf";

int fontId =QFontDatabase::addApplicationFont(fontPath);

if (fontId !=-1)

{

   QFont font("MyFont");

   app.setFont(font);

}

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
ARM QT移植详细步骤教程
Qt移植到ARM Linux教程
【嵌入式】
树莓派开发笔记(二):qt开发环境搭建:树莓派qt编译和宿主机qt交叉编译
最新版qtE4.5.2成功移植编译及运行
移植QT5.6到嵌入式开发板(史上最详细的QT移植教程)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服