Linux手机DIY.库文件专题.兼容性问题

Linux手机DIY.库文件专题.兼容性问题

草木瓜  于 2006-11-9


一、序

  软件移植过程的兼容性问题由来已久,因素也是十分复杂和多样。在实际过程中却有发现了一个更费解的现象,还是可恶的浮点问题!

二、重要提示

    为了方便更好的理解本文,提供下面链结。
    全系列的文章地址,手机应用开发专栏:http://blog.csdn.net/liwei_cmg
    相关的重要成果的下载地址:http://play.younet.com/view.php?tid=24045

三、初识兼容性问题

  夏新E600和飞利浦968手机系统是十分相近的,内核版本信息也是一致的,
不过即便这样,在模拟器移植过程中,E600使用968的QT库,都会有按键问题。
显然这是硬件有所不同的原因。
  Qnes模拟器能不能在E680上用呢,事实是不太可能的,因两者硬件差异太
大。以下描述我在E680上运行Qnes的提示信息。

  我将一些夏新E600本身特有lib文件加上后,仍然使用E680本地的QT库,设
置好环境变量,运行会出现:
  # ./r qnes
  ./qnes: relocation error: /mmc/mmca1/qnes/libcec.so.0: undefined
symbol: _ZThn184_N10QPopupMenu10updateItemEi
  说明自带的QT库缺少函数。我把E600的libqte-mt.so.2,和fonts复制过去,
运行倒是可以,只不过是不正常的运行,提示如下:

  ======== 240 x 320 x 16
  Default2: Cannot open /dev/ts (No such file or directory)
   ==========================================================
  theme config file [../Settings/theme/010Gray.conf] doesn't exist!
  JPEG parameter struct mismatch: library thinks size is 376, caller expects 372
   QImage::measure fail to guess image format
   csmCheckLimited : csm size 0/655360
   csmConstruct : csm info
   start 0x40551000
   size  655360
  could not open for writing `/Settings/cec.conf.new'
  QCopChannel: no client registered for channel CEC/Desktop, not sending stopStartupAnimation()
  ...
  QCopChannel: no client registered for channel CEC/IdleManager, not sending hideInputMethod()
  ...

  在E680手机上倒是显示了个新界面,并有英文的Load和Back。通过提示可以
清楚看出因两者硬件的差异生成兼容性的问题。不过也证实了上篇文章的推论,
浮点格式不同,最多是浮点运算有误,但是程序还是可以链结运行的。造成什么
Segmentation Fault的错误,还是直接来源于硬件。

  如我把E600的sysinfo放在E680运行会有如下提示:
  
  ======== 240 x 320 x 16
  Default2: Cannot open /dev/ts (No such file or directory)
   ==========================================================
  theme config file [../Settings/theme/010Gray.conf] doesn't exist!
   QImage::measure fail to guess image format
   csmCheckLimited : csm size 0/655360
   create csm : exist
   csmConstruct : csm info
   start 0x40871000
   size  655360
  could not open for writing `/Settings/cec.conf.new'
  Can't make QGfx for null pixmap
  
  QPainter::begin: Unable to get graphics context
  Segmentation fault
  
  这个Segmentation fault可能来自于显示设备的,具体原因不详,如做
反汇编处理,会了解更多的信息。

四、测试简单的浮点运算

  编译环境:
  VFP gcc-3.3.2 glibc-2.3.2 binutils-2.15 kernel 2.4.20
  FPA gcc-3.4.0 glibc-2.2.5 binutils-2.15 kernel 2.4.19

  先简单写个命令行程序如下:
  int main()
  {
  float fValueA=1.9;
  float fValueB=2.8;
  int iValueC=8;
  int iValueD=9999;
  printf("Hello!My E680G!/n");
  printf("TestValue(4.7):%f/n",fValueA+fValueB);
  printf("TestValue(9.9):%f/n",fValueA+iValueC);
  printf("TestValue(10007):%d/n",iValueC+iValueD);
  return 0;
  }

  1.vfp soft fp gcc-3.3.2 glibc-2.3.2 编译
  arm-linux-gcc -o hellocmdvfp hello.c
  
  2.fpa soft fp gcc-3.4.0 glibc-2.2.5 编译
  (加参数 -msoft-float 也是完全一样的)
  arm-linux-gcc -o hellocmdfpa hello.c
  
  ------------------------------------------------
  E680运行结果:
  
  # ./hellocmdvfp
  Hello!My E680G!
  TestValue(4.7):4.700000
  TestValue(9.9):9.900000
  TestValue(10007):10007
  
  # ./hellocmdfpa
  Hello!My E680G!
  TestValue(4.7):-2.000000
  TestValue(9.9):-2.000000
  TestValue(10007):10007
  
  FPA虽然有软浮点,但浮点运算依然出错。
  
  ------------------------------------------------
  E600和968的运行结果:
  
  #./hellocmdvfp
  Hello!My E680G!
  TestValue(4.7):-2.000000
  TestValue(9.9):-2.000000
  TestValue(10007):10007
  
  #./hellocmdfpa
  Hello!My E680G!
  TestValue(4.7):-2.000000
  TestValue(9.9):-2.000000
  TestValue(10007):10007
  
  -------------------------------------------------
  
  出乎我的意料,在E600上,浮点运算居然全出错,后来偶然间用VFP格式
的arm-linux-g++编译:
  arm-linux-g++ -o hellocmdvfp+ hello.c
  
  #./hellocmdvfp+
  Hello!My E680G!
  TestValue(4.7):4.700000
  TestValue(9.9):9.900000
  TestValue(10007):10007
  
  在E600上居然又运行正确,这令人十分奇怪。于是我再用FPA格式这样编
译:
  arm-linux-g++ -o hellocmdfpa+ hello.c
  
  因为是gcc.3.4.0版本,会提示libstdc++6.so.0和libgcc_s.so.1缺少。
加上库文件后运行结果如下(E680,E600,968结果完全一样):
  
  #.hellocmdfpa+
  Hello!My E680G!
  TestValue(4.7):-2.000000
  TestValue(9.9):-2.000000
  TestValue(10007):10007  

  显然都是错误的。


五、总结 
 
  VFP格式在E600,968上运行,可以说是没有浮点BUG的。不过FPA却总
有问题。VFP编译环境在编译过程中不能兼容E600,968本身的库文件,所
以才要用FPA的编译环境。
  浮点这个问题比较让人费解,还须要做进一步研究。


 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值