Linux手機DIY.庫檔案專題.相容性問題

來源:互聯網
上載者:User

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的編譯環境。
  浮點這個問題比較讓人費解,還須要做進一步研究。

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.