今日无事,尝试编译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
搞定
还没实际在板上跑。