今日編譯mipsel-linux的DirectFb碰壁及解決

今日無事,嘗試編譯DirectFb,使用的工具是君正的交叉編譯工具,http://www.ingenic.cn/product.aspx?ID=62

使用庫有:

jpeg-6b

freetype-2.5.0.1

DirectFB-1.7.0

步驟如下:

export PREFIX=/opt/mipsel
export LD_LIBRARY_PATH=$PREFIX/lib
export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
export ARCH=mips
export CROSS_COMPILE=/opt/mipseltools-gcc412-glibc261/bin/mipsel-linux-
export CC=${CROSS_COMPILE}gcc 
export CXX=${CROSS_COMPILE}g++ 
export AR=${CROSS_COMPILE}ar
export RANLIB=${CROSS_COMPILE}ranlib 
export NM=${CROSS_COMPILE}nm 
export AS=${CROSS_COMPILE}as
export LD=${CROSS_COMPILE}ld

cd jpeg-6b
./configure --prefix=$PREFIX --build=i686 --target=mips-linux --host=mips-linux
make
make install

cd freetype-2.5.0.1
./configure --prefix=$PREFIX --build=i686 --target=mips-linux --host=mips-linux
make
make install

這兩步之有個小問題,make install 時提示有些目錄不存在,比如/opt/man,手動創建再make install 一些就可以了。

cd DirectFB-1.7.0
./configure --prefix=$PREFIX --build=i686 --target=mips-linux --host=mips-linux --disable-x11 --with-gfxdrivers=none --enable-png=no "CFLAGS=-I/opt/mipsel/include"
make
問題來了
make[4]: Entering directory `/opt/directfb/DirectFB-1.7.0/lib/direct'
  CXX    String.lo
String.h:124: error: format string argument not a string type
String.h:129: error: format string argument not a string type
make[4]: *** [String.lo] 錯誤 1
make[4]: Leaving directory `/opt/directfb/DirectFB-1.7.0/lib/direct'
make[3]: *** [all-recursive] 錯誤 1
make[3]: Leaving directory `/opt/directfb/DirectFB-1.7.0/lib/direct'
make[2]: *** [all-recursive] 錯誤 1
make[2]: Leaving directory ``/opt/directfb/DirectFB-1.7.0/lib'
make[1]: *** [all-recursive] 錯誤 1
make[1]: Leaving directory `/opt/directfb/DirectFB-1.7.0'
make: *** [all] 錯誤 2

/opt/directfb/是我存放源碼的目錄。
打開/opt/directfb/DirectFB-1.7.0/lib/direct/目錄下String.h,找到124行到129行,內容如下:
     PrintF( const _CharT *format, ... )          D_FORMAT_PRINTF(2);

     StringBase &
     PrintF( const _CharT *format, va_list args, size_t stack_buffer = 300 );

     static StringBase F( const _CharT *format, ... ) D_FORMAT_PRINTF(1);
由於提示的錯誤是format string argument not a string type,說明參數format的類型必須是字符串類型(帶點經驗的猜測),所以修改如下:
     PrintF( const char *format, ... )          D_FORMAT_PRINTF(2);

     StringBase &
     PrintF( const char *format, va_list args, size_t stack_buffer = 300 );

     static StringBase F( const char *format, ... ) D_FORMAT_PRINTF(1);
搞定
make
通過
make install
搞定

還沒實際在板上跑。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章