linux qt 4.8 x86 arm开发环境配置(openSUSE Leap 42.1)

需要的文件:arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz,tslib-1.4.tar.gz,qt-everywhere-opensource-src-4.8.6.tar.gz
一,tslib按装
觸摸屏軟體 tslib1.4.tar.gz tslib是觸摸屏校準的庫,這個是tslib源碼,可以移植到嵌入式設備中對觸摸屏進行校準在採用觸摸屏的移動終端中,觸摸屏性能的調試是個重要問題之一,因為電磁雜訊的緣故,觸摸屏容易存在點擊不準確、有抖動等問題。
Tslib是一個開源的 程序 ,能夠為觸摸屏驅動獲得的採樣提供諸如濾波、去抖、校準等功能,通常作為觸摸屏驅動的適配層,為上層的應用提供了一個統一的介面。在Qtopia 4.*版本中,默認的Tslib版本為Tslib 1.4。在Qtopia 2.*版本中,默認的Tslib版本為Tslib 1.3
1.解壓縮:tar -zxvf tslib1.4.tar.gz
2.運行./autogen.sh

echo  "ac_cv_func_malloc_0 _nonnull=yes" >arm-linux.cache


./autogen.sh: 4: autoreconf: not found
 是在不同版本的 tslib 下執行 autogen.sh 產生。它們產生的原因一樣,是因為沒有安裝
  automake 工具,      (ubuntu 8.04)用下面的命令安裝好就可以了。
  sudo apt-get install autoconf automake libtool
3.運行
./configure --host=arm-linux --prefix=/opt/tslib-1.4  ac_cv_func_malloc_0_nonnull=yes
./configure --host=arm-none-linux-gnueabi --cache-file=arm-none-linux-gnueabi.cache --enable-inputapi=no -prefix= /opt/tslib-1.4
4.make
在make時出錯,提示
In function 『open』,
inlined from 『main』 at ts_calibrate.c:229:11:
/usr/include/bits/fcntl2.h:51:24: error: call to 『__open_missing_mode』 declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[2]: *** [ts_calibrate.o] Error 1
解決方法:
這是因為open函數的語法不符合最新的gcc,在/tests/ts_calibrate.c中加入open的第三個參數0777:
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
cal_fd = open (calfile, O_CREAT | O_RDWR, 0777);
} else {
cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0777);
}
5.make install
編譯安裝成功如下圖:

———————————————————————————————————————————————————————————————————
配置編譯安裝ARM平台qt:  下載頁面:http://qt-project.org/downloads
選擇  Qt
libraries 4.8.5 for Linux/X11 (230 MB)  ( Info ) 得到qt-everywhere-opensource-src-4.8.5.tar.gz,這個和 Qt
libraries 4.8.5 for embedded Linux (230 MB)  ( Info ) 是同一個文件,配置不同就可以編譯出不同的版本

二, arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz
1,下载并安装arm-linux-gcc

arm-linux-gcc-4.2.1的版本在http://ftp.snapgear.org/pub/snapgear/tools/arm-linux/这里可以下载,最新版arm-linux-tools-20080623.tar.gz这个可能是4.2.4的版本,因为下面有编译4.2.4的方法还有相应的代码包,build-arm-linux-4.2.14,此版本由于过大,我没有下载。

下面的这个是ARM官方给的下载链接http://www.codesourcery.com/gnu_toolchains/arm/download.html,然后将HOST选择为IA32 GNU/Linux,点击下载就可以了。不过前缀为arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu而不是arm-linux-。。。

       在友善之臂官方网站http://www.arm9.net/download.asp下载arm-linux-gcc4.4.3。

2,删除之前安装有旧版本,执行

 [root@localhost ~]# rm -rf /opt/arm

3,对新版本arm-linux-gcc-4.4.3进行解压(注意,如果我们加上了-C,那么就会自动解压到/usr/local/arm/这个目录下),但是友善之臂按照下列方式解压,不会解压到/usr/local/arm/目录下的,这是因为友善之臂把/usr/local/arm/目录修改成了 /opt/FriendlyARM/toolschain/,除非自己在把它修改过来
[root@localhost ~]# tar -ivxzf /smbroot/arm-linux-gcc-4.4.3.tar.gz  -C /

4,修改配置文件,将arm-linux-gcc添加到环境变量中,因为arm-linux-gcc的命令是在/usr/local/arm/4.4.3/bin下,其目的通过对全局变量绑定使之能够在任意一个目录下能够执行该命令。

打开设置文件

[root@localhost opt]# vi /etc/profile

在打开的文件的

# Path manipulation
if [ "$EUID" = "0" ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
        pathmunge /usr/local/arm/4.4.3/bin
fi
或者在文件末尾添加

export PATH=/ opt/FriendlyARM/toolschain/4.5.1/bin :$PATH  

保存退出

5,立即使新的环境变量生效,不用重启电脑

[root@localhost opt]#  source /etc/profile

[root@localhost opt]# 

6,检查是否将路径加入到PATH:

[root@localhost opt]# echo $PATH

显示的内容中有/usr/local/arm/4.4.3/bin,说明已经将交叉编译器的路径加入PATH。至此,交叉编译环境安装完成。
7,测试是否安装成功

首先,执行find命令查询一下arm-linux-gcc的位置

[root@localhost ~]# find / -name arm-linux-gcc

/opt/arm/toolschain/4.4.3/bin/arm-linux-gcc
[root@localhost ~]# 

可以看到arm-linux-gcc的位置与环境变量中设定的路径一致

接下来查询arm-linux-gcc的版本

[root@localhost bin]# arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-mpfr=/opt/FriendlyARM/toolschain/4.4.3 --with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.4.3 (ctng-1.6.1) 
[root@localhost bin]# 

可以看到arm-linux-gcc的版本号,至此,arm-linu-gcc已成功安装。
三,x86_qt




opensuse--
zypper install mesa-lib*
zypper install libX*
zypper install libX11-devel libXext-devel libXtst-devel
centos --
yum install libX*
 yum install libX11-devel libXext-devel libXtst-devel
ubuntu -- apt-get install libX11-dev libXext-dev libXtst-dev

./configure --prefix=/opt/x86_qt -webkit-debug -debug -fontconfig
gmake
gmake install


//gmake confclean

四,修改qmake.conf文件


修改以下文件
/root/tool/qt-everywhere-opensource-src-4.8.0/mkspecs/qws/linux-arm-g++/qmake.conf 
#
# qmake configuration for building with arm-linux-g++
#
QMAKE_INCDIR +=/usr/local/tslib/include/
QMAKE_LIBDIR +=/usr/local/tslib/lib/
QMAKE_LIBDIR +=/usr/local/tslib/lib/ts
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = /dev-lib/toolschain/4.5.1/bin/arm-linux-gcc -lts
QMAKE_CXX = /dev-lib/toolschain/4.5.1/bin/arm-linux-g++ -lts
QMAKE_LINK = /dev-lib/toolschain/4.5.1/bin/arm-linux-g++ -lts
QMAKE_LINK_SHLIB = /dev-lib/toolschain/4.5.1/bin/arm-linux-g++ -lts
# modifications to linux.conf
QMAKE_AR = arm-linux-ar cqs
QMAKE_OBJCOPY = arm-linux-objcopy
QMAKE_STRIP = arm-linux-strip
load(qt_config)



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


QMAKE_INCDIR    +=/opt/tslib-1.4/include/
QMAKE_LIBDIR    +=/opt/tslib-1.4/lib/
QMAKE_LIBDIR    +=/opt/tslib-1.4/lib/ts 


# modifications to g++.conf 
QMAKE_CC                = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc -lts
QMAKE_CXX               = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ -lts
QMAKE_LINK              = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ -lts
QMAKE_LINK_SHLIB        = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-g++ -lts


# modifications to linux.conf 
QMAKE_AR                = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-ar cqs 
QMAKE_OBJCOPY           = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-objcopy 
QMAKE_STRIP             = /opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-strip 


load(qt_config)

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
五,arm_4.8
gmake confclean
make clean
./configure -v -prefix /opt/qt-4.8.5-arm -opensource -confirm-license -embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -qt3support -no-xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -make tools -make examples -make demos -make translations -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-arm-g++ -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 -fontconfig -I/opt/tslib-1.4/include -L/opt/tslib-1.4/lib


gmake
如果出现如下错误:
cc1:error:.pch/release-shared-emb-arm/QtGui:NO such file or directory
在配置时添加参数:    -no-pch

gmake install
如果出现如下错误:
make[1]: 正在进入目录 `/home/duliqun/qt-everywhere-opensource-src-4.8.5/src/corelib'
g++ -c -include .pch/release-shared-emb-arm/QtCore -pipe -I/opt/tslib-1.0/include -fno-exceptions -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_QLOCALE_USES_FCVT -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DELF_INTERPRETER=\"\" -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG -I../../mkspecs/linux-g++ -I. -I../../include -I../../include/QtCore -I.rcc/release-shared-emb-arm -Iglobal -I../3rdparty/zlib -I../3rdparty/harfbuzz/src -I../3rdparty/md5 -I../3rdparty/md4 -I.moc/release-shared-emb-arm -o .obj/release-shared-emb-arm/qabstractanimation.o animation/qabstractanimation.cpp
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h: Assembler messages:
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h:131: Error: no such instruction: `swpb %cl,%dl,[%ebp]'
../../include/QtCore/../../src/corelib/arch/qatomic_armv5.h:131: Error: no such instruction: `swpb %dl,%sil,[%ebp]'
可能是arm 交叉环境有问题,如果配置好了一般reconfigure下就ok.如果总是有问题,可以修改qatomic_armv5.h,将汇编用c code写可以避过这个错误。
vi /home/duliqun/qt-everywhere-opensource-src-4.8.5/src/corelib/arch/qatomic_armv5.h
inline char q_atomic_swp(volatile char *ptr, char newval)
{
register char ret;
/*asm volatile("swpb %0,%2,[%3]"
: "=&r"(ret), "=m" (*ptr)
: "r"(newval), "r"(ptr)
: "cc", "memory");*/
ret=*ptr;
*ptr=newval;
return ret;
}

如果出现如下错误:
In file included from ssl/qsslsocket_openssl_symbols_p.h:57:0,    from ssl/qsslcertificate.cpp:110:
ssl/qsslsocket_openssl_p.h:66:26: 致命错误: openssl/asn1.h:没有那个文件或目录编译中断。
make[1]: *** [.obj/release-shared-emb-arm/qsslcertificate.o] 错误 1
make[1]:正在离开目录 `/home/duliqun/qt-everywhere-opensource-src-4.8.5/src/network'
make: *** [sub-network-make_default] 错误 2
请执行:  
sudo apt-get install openssl 
sudo apt-get install libssl-dev

3.make  install 编译安装成功。


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值