首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Qt4.7.3交叉编译移栽

2012-08-21 
Qt4.7.3交叉编译移植Qt4.7.3交叉编译移植作者:风竹郎 2012-07-26前言:由于我新增加了一个扩展盘,启动系统

Qt4.7.3交叉编译移植

Qt4.7.3交叉编译移植

作者:风竹郎 2012-07-26

前言:

              由于我新增加了一个扩展盘,启动系统后都必须挂在这个盘。

#sudo fdisk –l

#mount /dev/sdb1 /home/ema/dvsdk

一、     解压QTE,新建平台目录

1、          解压

#tar –xzvf qt-everywhere-opensource-src-4.7.3.tar.gz

#cd qt-everywhere-opensource-src-4.7.3/

2、          新建平台目录

#cd mkspecs/qws

#cp linux-arm-g++ linux-omap3-g++

#cd linux-omap3-g++

二、     安装交叉编译器,设置环境变量

1、          解压交叉编译器

#cd /home/ema/arm-linux

#tar –xjvf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

2、          设置编译器的环境变量

#vim ~/.bashrc

#exportPATH=/home/ema/arm-linux/arm-2009q1/bin:$PATH

# export  LD_LIBRARY_PATH=/home/ema/arm-linux/arm-2009q1/lib:$ LD_LIBRARY_PATH

三、     安装DVSDK,设置环境变量

1、          解压DVSDK

#cd /home/ema/

#mkdir dvsdk

#tar –xjvf ti-dvsdk_dm3730-evm_4_02_00_06.tar.bz2

2、          设置移植库的环境变量

#export LD_LIBRARY_PATH=/home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib:$LD_LIBRARY_PATH

#export LD_LIBRARY_PATH=/home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x/freedesktop/kdrive/usr/X11R6_SGX/lib:$LD_LIBRARY_PATH

#export LD_LIBRARY_PATH=/home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x:$LD_LIBRARY_PATH

四、     修改交叉编译文件,设定编译环境

添加DBUS、TSLIB、FREETYPE、ALSA、JPEG、PNG交叉编译库以及头文件路径

# cd /home/ema/qt-everywhere-opensource-src-4.7.3/mkspecs/qws

#vim qmake.conf

#

# qmake configuration for building with arm-linux-g++

#

include(../../common/g++.conf)

include(../../common/linux.conf)

include(../../common/qws.conf)

 

 

QMAKE_INCDIR            = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/dbus-1.0 /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib/dbus-1.0/include /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/alsa /home/ema/arm-linux/arm-2009q1/lib/lib-arm/tslib/include /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib/glib-2.0/include /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/libxml2/libxml /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/glib-2.0/glib /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/glib-2.0/gobject /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/glib-2.0/include /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/include/gstreamer-0.10

 

QMAKE_LIBDIR            = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib/alsa-lib/smixer /home/ema/arm-linux/arm-2009q1/lib/lib-arm/tslib/lib /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/linux-devkit/arm-none-linux-gnueabi/usr/lib /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x

 

LIBS += -ldbus-1 -lrt -lglib-2.0 -lgthread-2.0 -lIMGegl -lsrv_um -pthread -pthread -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lxml2 -lglib-2.0 -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 -lts -lz

 

# 修改g++里的宏定义

#设置使用ARM高级特性的编译标志

QMAKE_CFLAGS_RELEASE    = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp

QMAKE_CXXFLAGS_RELEASE  = -O2 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp

# modifications to g++.conf

QMAKE_CC                = arm-none-linux-gnueabi-gcc

QMAKE_CXX               = arm-none-linux-gnueabi-g++

QMAKE_LINK              = arm-none-linux-gnueabi-g++

QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++

 

# modifications to linux.conf

QMAKE_AR                = arm-none-linux-gnueabi-ar cqs

QMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopy

QMAKE_STRIP             = arm-none-linux-gnueabi-strip

 

load(qt_config)

五、     制作shell脚本,配置编译选项

1、          查看配置参数,根据需要选配

//查看配置参数

#./configure –h

#cd /home/ema/ qt-everywhere-opensource-src-4.7.3

 

#vim arm-config.sh

#!/bin/sh

 

./configure \

        -prefix /usr/local/qt-emembeded-4.7.3-arm-linux \

        -opensource \

        -release \

        -shared \

        -qt3support \

        -webkit \

        -system-nas-sound \

        -qt-zlib \

        -optimized-qmake \

        -confirm-license \

        -xplatform qws/linux-omap3-g++ \

        -embedded arm \

        -depths 16 \

        -release \

        -fast \

        -no-pch \

        -dbus \

        -force-pkg-config \

        -phonon \

        -phonon-backend \

        -qt-libjpeg \

        -qt-libpng \

        -qt-libtiff \

        -multimedia \

        -qt-libmng \

        -qt-freetype \

        -qt-mouse-tslib -qt-mouse-linuxtp -qt-mouse-pc \

        -exceptions \

        -opengl \

        -openvg \

        -xmlpatterns \

        -no-mmx -no-3dnow -no-sse -no-sse2 -no-sse3 -no-sse4.1 -no-sse4.2 \

        -no-avx -no-openssl -no-cups -no-ssse3 \

        -nomake examples -nomake demos -nomake docs -nomake tools \

        -no-qvfb \

        -no-openssl \

        -qt-gfx-linuxfb \

        -v

 

2、          增加X11库的库文件、头文件配置

 

#vim ./mkspecs/qws/linux-omap3-g++/../../commen/qws.conf

#

# qmake configuration common for QWS

#

 

MAKEFILE_GENERATOR      = UNIX

TARGET_PLATFORM        = unix

TEMPLATE                = app

CONFIG                 += qt warn_on release incremental link_prl

QT                     += core gui network

QMAKE_INCREMENTAL_STYLE = sublib

 

# modifications to linux.conf

QMAKE_INCDIR_X11        = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x/freedesktop/kdrive/usr/X11R6_SGX/include

QMAKE_LIBDIR_X11        = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x/freedesktop/kdrive/usr/X11R6_SGX/lib

QMAKE_INCDIR_OPENGL     = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include /home/linuxsir/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include

QMAKE_LIBDIR_OPENGL     = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x

QMAKE_INCDIR_OPENGL_ES1 = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include

QMAKE_LIBDIR_OPENGL_ES1 = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x

QMAKE_INCDIR_OPENGL_ES2 = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES/Include

QMAKE_LIBDIR_OPENGL_ES2 = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x

QMAKE_LIBS_X11          = -lXext -lX11 -lm

QMAKE_LIBS_X11SM        = -lSM -lICE

QMAKE_LIBS_OPENGL       = -lGLU -lGL

QMAKE_LIBS_OPENGL_QT    = -lGL

 

3、增加OpenGL、OpenGV,2D、3D图形库机器头文件配置

 

#vim ./mkspecs/qws/linux-omap3-g++/../../commen/qws.conf

#

# qmake configuration for common linux

#

 

QMAKE_CFLAGS_THREAD    += -D_REENTRANT

QMAKE_CXXFLAGS_THREAD  += $$QMAKE_CFLAGS_THREAD

 

QMAKE_INCDIR          =

QMAKE_LIBDIR          =

QMAKE_INCDIR_X11      = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x/freedesktop/kdrive/usr/X11R6_SGX/include

QMAKE_LIBDIR_X11      = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x/freedesktop/kdrive/usr/X11R6_SGX/lib

QMAKE_INCDIR_QT       = $$[QT_INSTALL_HEADERS]

QMAKE_LIBDIR_QT       = $$[QT_INSTALL_LIBS]

QMAKE_INCDIR_OPENGL   = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include

QMAKE_LIBDIR_OPENGL   = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x

QMAKE_INCDIR_OPENGL_ES1 = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include

QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL

QMAKE_INCDIR_OPENGL_ES2 = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include

QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL

QMAKE_INCDIR_EGL      = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include

QMAKE_LIBDIR_EGL      = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x

QMAKE_INCDIR_OPENVG   = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/GFX_Linux_SDK/OVG/SDKPackage/Builds/OVG/Include

QMAKE_LIBDIR_OPENVG   = /home/ema/dvsdk/ti-dvsdk_dm3730-evm_4_02_00_06/omap35x_graphics_sdk_4.00.00.01/gfx_dbg_es2.x

 

QMAKE_LIBS            =

QMAKE_LIBS_DYNLOAD    = -ldl

QMAKE_LIBS_X11        = -lXext -lX11 -lm

QMAKE_LIBS_X11SM      = -lSM -lICE

QMAKE_LIBS_NIS        = -lnsl

QMAKE_LIBS_EGL        = -lEGL

QMAKE_LIBS_OPENGL     = -lGLU -lGL

QMAKE_LIBS_OPENGL_QT  = -lGL

QMAKE_LIBS_OPENGL_ES1 = -lGLES_CM

QMAKE_LIBS_OPENGL_ES2 = -lGLESv2

QMAKE_LIBS_OPENVG     = -lOpenVG

QMAKE_LIBS_THREAD     = -lpthread

 

QMAKE_MOC             = $$[QT_INSTALL_BINS]/moc

QMAKE_UIC             = $$[QT_INSTALL_BINS]/uic

 

QMAKE_AR              = ar cqs

QMAKE_OBJCOPY         = objcopy

QMAKE_RANLIB          =

 

QMAKE_TAR             = tar -cf

QMAKE_GZIP            = gzip -9f

 

QMAKE_COPY            = cp -f

QMAKE_COPY_FILE       = $(COPY)

QMAKE_COPY_DIR        = $(COPY) -r

QMAKE_MOVE            = mv -f

QMAKE_DEL_FILE        = rm -f

QMAKE_DEL_DIR         = rmdir

QMAKE_STRIP           = strip

QMAKE_STRIPFLAGS_LIB += --strip-unneeded

QMAKE_CHK_DIR_EXISTS  = test -d

QMAKE_MKDIR           = mkdir -p

QMAKE_INSTALL_FILE    = install -m 644 -p

QMAKE_INSTALL_PROGRAM = install -m 755 -p

 

include(unix.conf)

 

六、     执行配置,交叉编译安装

     #./ arm-config.sh

            #make

            #sudo make install

热点排行