2012-10-11 55 views
0

試圖獲得可用於基於運行Linux 2.6.35.3的i.MX53處理器(它是ARM Cortex-A8內核)的嵌入式系統的工作directfb(由飛思卡爾提供)。針對iMX.53的DirectFB交叉編譯 - 啓動時崩潰

我在我的i686 debian主機系統上安裝了交叉編譯器。交叉編譯器來自embedian.org存檔,並且是gcc-4.3-arm-linux-gnueabi包(arm-linux-gnueabi-gcc (Debian 4.3.2-1.1) 4.3.2)。這是由glibc 2.7提供的。這是與我的目標系統版本不同的版本,即glibc 2.11,儘管我的閱讀表明它們應該兼容。

經過對系統映像中已存在的庫進行了大量實驗後,我成功地編譯了directfb 1.6.2。這是由事實,我沒有對已經安裝的庫工作pkg配置信息很複雜,但我最終設法說服它使用下列configure命令行編譯:

TOP=`realpath ../..` 
PKG_CONFIG_PATH=${TOP}/ext/libpng-1.5.13/ \ 
LIBPNG_CFLAGS=-I${TOP}/include \ 
LIBPNG_LDFLAGS="-L${TOP}/libs -lpng15 -lz" \ 
FREETYPE_CFLAGS=-I${TOP}/include \ 
FREETYPE_LIBS="-L${TOP}/libs -lfreetype" \ 
LIBS="-lgcc_s -lgcc -ldl -lstdc++ -lz" \ 
CFLAGS="-march=armv7-a" \ 
CXXFLAGS="-march=armv7-a" \ 
./configure CC=arm-linux-gnueabi-gcc CPPFLAGS=-I${TOP}/include LDFLAGS=-L${TOP}/lib \ 
    --build=i686-linux --host=arm-linux-gnueabi \ 
    --enable-static --disable-shared \ 
    --disable-freetype --enable-fbdev --disable-x11 \ 
    --with-gfxdrivers=none --with-inputdrivers=none 

這成功地建立,我可以在http://directfb.org/docs/DirectFB_Tutorials/simple.html上編譯和鏈接基於簡單教程應用程序的示例應用程序 - 不幸的是,當在目標系統上運行時,應用程序會與SIGSEGV一起崩潰。 directfb也包含一些工具,例如dfbinfo。

這是我的測試應用程序崩潰(當與命令行參數 「--dfb:的fbdev =的/ dev/FB0」 運行):的堆棧跟蹤

#0 direct_map_lookup (map=0x0, key=0xdfd70) at map.c:298 
#1 0x000b2d9c in direct_config_set (name=0xdfd70 "fbdev", 
    value=0xdfd76 "/dev/fb0") at conf.c:542 
#2 0x0009edc0 in dfb_config_set (name=0xdfd70 "fbdev", 
    value=0xdfd76 "/dev/fb0") at conf.c:2024 
#3 0x000a2dcc in parse_args (args=0x7ea80d53 "fbdev=/dev/fb0") at conf.c:297 
#4 0x000a305c in dfb_config_init (argc=0x7ea80968, argv=0x7ea80964) 
    at conf.c:2159 
#5 0x0000cd58 in Display::Display() 
#6 0x0000ba94 in main() 

作爲參考,唯一DirectFB的相關代碼崩潰之前的應用程序來執行,直接從教程代碼複製:

Display::Display(int argc, char ** argv) 
{ 
    DFBSurfaceDescription dsc;  
    DFBCHECK (DirectFBInit (&argc, &argv)); 
    // ... crash occurs during execution of the line above 
} 

這是直接從我的main函數調用,傳遞原始未修改argc和argv。

我在/ usr/local/lib中的目標系統上安裝了directfb庫,並在/ usr/local/bin中安裝了二進制文件,並創建了/usr/local/share/directfb-1.6.2(包含cursor.dat和decker.dgiff)以及文檔中建議的/etc/fb.modes。

任何關於我做錯了什麼的建議?

回答

0

閱讀源代碼從git.directfb.org conf.cmaps.c並檢查你的籌碼......

#0 direct_map_lookup (map=0x0, key=0xdfd70) at map.c:298 
#1 0x000b2d9c in direct_config_set (name=0xdfd70 "fbdev", value=0xdfd76 "/dev/fb0") at conf.c:542 

映射爲null。這應該map.c斷言:295,但看起來這是禁用的,但在298

hash = map->hash(map, key, map->ctx); 

上一頁通話中conf.c而不是崩潰了:542,

ConfigOption *option = direct_map_lookup(config_options, name); 

這意味着config_options是null。僅在該文件中搜索纔會將其分配給文件__D_conf_init()

我對directfb一無所知,但看起來您需要直接或間接致電__D_conf_init

+1

謝謝。這讓我走上了正確的軌道 - 看起來__D_conf_init被設置爲在libdirectfb.so動態鏈接到應用程序時自動調用。但我靜靜地把它連接起來。靜態鏈接顯然是受支持的,但你必須採取特殊的步驟,並且用於執行這些步驟的腳本顯然不再分佈。切換到動態鏈接,並且一切正常。 – Jules