QT4.8.5在linux下搭建嵌入式开发环境

2019-07-12 17:22发布

主机环境:Ubuntu14.04 LTS
编译器:arm-linux-gcc 4.3.3 开发板:TQ2440,Linux-2.6.30.4  一 编译tslib库:
把tslib-1.4.tar.gz放到一个目录下,比如/opt目录下。接着执行命令如下:        #tar zxvf tslib-1.4.tar.gz  执行命令cd tslib,进入tslib当前目录,接着执行命令如下:        #./autogen.sh  然后接着执行配置命令:        #./configure     --prefix=/usr/local/tslib --host=arm-linux ac_cv_func_malloc_0_nonnull=yes  最后执行编译命令和安装命令如下:       1.        make         2.        make install  如果以上步骤没错,则可以在/usr/local/tslib下出现我们需要的库文件,这些库文件我们移植时会用到。 编译期间出现的错误:./autogen.sh: 4: autoreconf: not found 解决办法:sudo apt-get install autoconf automake libtool
二 编译QT4.8.5源码 1:解压qt-everywhere-opensource-src-4.8.5.tar.gz        #tar zxvf qt-everywhere-opensource-src-4.8.5.tar.gz 2:建立目录:mkdir /opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm 3:进入qt-everywhere-opensource-src-4.8.5目录,输入如下命令 注意:先通过 --prefix 指定qt安装的路径,-I后面指定上一步tslib的include路径,-L后面指定上一步tslib的lib路径 sudo ./configure --prefix=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm -opensource -release -shared -Declarative -importdir /opt/imports -fast -no-largefile -qt-sql-sqlite -qt3support -exceptions -xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -svg -no-webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -make tools -nomake examples -nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp -qt-mouse-tslib -DQT_QLOCALE_USES_FCVT -DQT_NO_QWS_CURSOR -no-pch -I/usr/local/tslib/include -L/usr/local/tslib/lib -confirm-license
# make # make install
在编译的时候出现如下错误:        The tslib functionality test failed!        You might need to modify the include and library search paths by editing         QMAKE_INCDIR and QMAKE_LIBDIR in           /home/hero/work/qtarm-build/mkspecs/qws/linux-arm-g++. 解决办法:把ARM-LINUX-GCC的路径设置正确 如下设置
修改源码路径:qt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-arm-g++/qmake.conf  #
# qmake configuration for building with arm-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                =/usr/local/arm/4.3.3/bin/arm-none-linux-gnueabi-gcc
QMAKE_CXX               =/usr/local/arm/4.3.3/bin/arm-none-linux-gnueabi-g++
QMAKE_LINK              =/usr/local/arm/4.3.3/bin/arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB        =/usr/local/arm/4.3.3/bin/arm-none-linux-gnueabi-g++


# modifications to linux.conf
QMAKE_AR                =/usr/local/arm/4.3.3/bin/arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           =/usr/local/arm/4.3.3/bin/arm-none-linux-gnueabi-objcopy
QMAKE_STRIP             =/usr/local/arm/4.3.3/bin/arm-none-linux-gnueabi-strip


QMAKE_INCDIR=/usr/local/tslib/include/
QMAKE_LIBDIR=/usr/local/tslib/lib/

QMAKE_CFLAGS           += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4 -mtune=arm920t
QMAKE_CXXFLAGS         += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4 -mtune=arm920t

load(qt_config)

三 设置环境变量 1 输入命令:gedit /etc/profile 在最末尾添加如下,注意目录一定相同/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm
export QPEDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm
export QTOPIA_DEPOT_PATH=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin
export QTDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm
export DQTDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm
export QMAKE=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin/qmake
export UIC=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin/uic
export TMAKEDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin
export TMAKEPATH=$TMAKEDIR/lib/qws/linux-arm-g++
export PATH=$QPEDIR/bin:$QTDIR/bin:$DQTDIR/bin:$TMAKEDIR/bin:$PATH
export LD_LIBRARY_PATH=$QPEDIR/lib:$QTDIR/lib:$DQTDIR/lib:$LD_LIBRARY_PATH
2 跟新环境变量命令:source /etc/profile