Chinaunix首页 | 论坛 | 博客
  • 博客访问: 316573
  • 博文数量: 40
  • 博客积分: 892
  • 博客等级: 准尉
  • 技术积分: 445
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-25 10:20
文章存档

2011年(40)

分类: 嵌入式

2011-01-29 19:10:39

交叉编译环境 Ubuntu 10.04 内核版本 2.6.32 交叉工具链为 mipsel-linux-gcc-3.3

目录结构图

|-opt            |-home

   |-include         |- cross

   |-bin                 |- SDL-1.2.13

   |-lib                 |- SDL_image-1.2.10

   |-share               |- SDL_ttf-2.0.9

                         |- agar-1.3.4

  |-Cross                |- libpng-1.4.2

      |-target           |- freetype-2.4.3

           |-local       |- libiconv-1.13.1

                         |- expat-2.0.1

                         |- jpeg-7

                         |- zlib-1.2.5

 

6.编译SDL-1.2.13
 

软件名称

SDL-1.2.13

功能描述

SDL是一个自由的跨平台的多媒体开发包,适用视频音频和其他应用的软件

下载地址

软件版本

SDL-1.2.13.tar.gz

依赖关系

默认

前置条件

源文件位置:$(work_dir)/SDL-1.2.13.tar.gz

 

添加环境变量 export PATH=/Cross/target/local/bin:$PATH

# ./configure -–host=mipsel-linux -–prefix=/opt --build=i686-pc-linux –-disable-static  \

                       –-disable-nasm –-disable-video-x11 –-disable-x11-shared –-disable-dga   \      –-disable-video-dga –-disable-video-x11-dgamouse –-disable-video-x11-vm \ 

   –-disable-video-x11-xv -–disable-video-x11-xinerama -–disable-video-x11-xme     \          --disable-video-x11-xrander --disable-video-x11-dpms --disable-video-svga     \            --enable-input-tslib  --disable-esd --disable-esdtest --disable-esd-shared --without-x

 

# make

 

# make install

6.1SDL/test 范例编译

 

# ./configure --host=mipsel-linux --prefix=/opt --without-x;

 

#make

提醒:若出现以下错误请修改Makefile文件

ngson/cross-sdl/lib/libSDL.so, not found (try using -rpath or -rpath-link)

/home/loongson/cross-sdl/lib/libSDL.so: undefined reference to `libiconv_open'

/home/loongson/cross-sdl/lib/libSDL.so: undefined reference to `libiconv_close'

/home/loongson/cross-sdl/lib/libSDL.so: undefined reference to `libiconv'

collect2: ld returned 1 exit status

make: *** [checkkeys] Error 1

 

$ vim Makefile

>CFLAGS = -Wl,--rpath-link -Wl,/opt/lib -I/opt/include -I/opt/include/SDL -D_GNU_SOURCE=

1 -D_REENTRANT -I/usr/include

  = -g -O2

 

 

7.编译SDL_image-1.2.10
 

软件名称

SDL_image-1.2.10

功能描述

SDL_image是用于处理图形文件的开源函数库

下载地址

http://www.libsdl.org/projects/SDL_image/

软件版本

SDL_image-1.2.10.tar.tar

依赖关系

默认

前置条件

源文件位置:$(work_dir)/SDL_image-1.2.10

添加环境变量 export PATH=/Cross/target/local/bin:$PATH

# ./configure --host=mipsel-linux --build=i686-pc-linux --prefix=/opt --with

-sdl-prefix=/opt --enable-jpg --enable-png :LIBPNG_CFLAGS=“-I/opt/include

libpng14” LIBPNG_LIBS=“-L/opt/lib -lpng14” LIBS=“-L/opt/lib ljpeg” CFLAGS= “-

I/opt/include”

 

#make

 

#make install

 

----------------------------若编译报错,请修改Makefile文件--------------------------

 

-I/usr/local/include/SDL

>CFLAGS= -I/opt/include/SDL

  -L /usr/local/lib –LSDL –lpthread

>LIBS=-Wl,rpath,/opt/lib –L/opt/lib –LSDL -lpthread

LIBPNG选项 添加成如下参数(默认为空):

>LIBPNG_CFLAGS = -I/opt/include/libpng13

>LIBPNG_LIBS = -lpng14

>LIBS = -Wl,-rpath,/opt/lib/ -L/opt/lib -lSDL -lpthread

SDL_CFLAGSSDL_LIBS选项也修改成如下

>SDL_CFLAGS = -D_GUN_SOURCE=1 -D_REENTRANT -I/opt/include/SDL

>SDL_LIBS = -Wl,-rpath,/opt/lib -L/opt/lib -lSDL -lpthread

 

# make CC=mipsel-linux-gcc

 

# make install

 

 

 

8.编译SDL_ttf

 

软件名称

SDL_ttf-2.0.9

功能描述

SDL_ttf是让应用程序能渲染汉字的扩展库

下载地址

软件版本

SDL_ttf-2.0.9.tar.gz

依赖关系

默认

前置条件

源文件位置:$(work_dir)/SDL_ttf-2.0.9

添加环境变量 export PATH=/Cross/target/local/bin:$PATH

 

# ./configure –-host=mipsel-linux –-build=i686-pc-linux –-prefix=/opt --with-

sdl-prefix=/opt --with-freetype-prefix=/opt --without-x LDFLAGS=“-L/opt/lib

-lSDL -liconv -lfreetype”

 

#make

 

#make install

 

----------------------若编译不通过,请修改Makefile文件,添加依赖关系--------------------

 

 

>CFLAGS = -g -O2 -I/opt/include/freetype2 -I/opt/include -I/opt/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -I/opt/include

 

>FREETYPE_CONFIG = /opt/bin/freetype-config

 

>LIBS = -L/opt/lib -lfreetype -L/opt/lib -Wl,-rpath,/opt/lib -lSDL -lpthread

 

>SDL_CFLAGS = -I/opt/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT

 

>SDL_CONFIG = /opt/bin/sdl-config

 

>SDL_LIBS = -L/opt/lib -Wl,-rpath,/opt/lib -lSDL,-lpthread

 

# make CC=mipsel-linux-gcc  AR=mipsel-linux-ar RANLIB=mipsel-linux-ranlib CXX=mipsel-linux-g++

 

# make install

 

若出现以下错误

 

/home/Cross/SDL_ttf-2.0.9/showfont.c:268:undefined reference to 'libiconv_open'


则修改
149行参数为下图所示

LDFLAGS = -L/opt/lib -lSDL -liconv -lfreetype

# make CC=mipsel-linux-gcc  AR=mipsel-linux-ar RANLIB=mipsel-linux-ranlib CXX=mipsel-linux-g++

 

# make install

                                                    -By 甘甘 

阅读(6345) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~