linux arm交叉编译,安装Minigui 3.0.12心得
使用arm-linux 交叉编译器,编译安装 MiniGui3.0.12 心得:
1.Build system ubuntu 10.04
目标平台 ARM
先下载ARM的 交叉编译器 arm-2009q1-203-arm-none-linux-gnueabi
(下载地址: http://download.csdn.net/detail/alaofangel/6344351 和 http://download.csdn.net/detail/alaofangel/6344445
安装目标: /opt/arm-2009q1-203 安装方法 参见: http://blog.csdn.net/alaofangel/article/details/12206419 )
强烈建议使用 gnueabi 版本的cross compiler编译器,对于 2.6.18 以后的linux kernel ,eabi是个趋势!
注意: arm-2009q1-203 安装后,设置 系统PATH
#cd /root
#gedit .bashrc
找到PATH相关设置并修改,如果没有 PATH,在该文件的最后一行添加如下(强烈建议在 $PATH 之后):
export PATH=$PATH:/opt/arm-2009q1-203/bin:/opt/arm-2009q1-203/libexec/gcc/arm-none-linux-gnueabi/4.3.3:/opt/arm-2009q1-203/arm-none-linux-gnueabi/bin
2.到www.minigui.com 去下载MiniGui3.0.12(libminigui-gpl-3.0.12) 和所需的支持包(分别是: freetype-2.3.9, zlib-1.2.2, jpegsrc.v7, libpng-1.2.37)
以及Minigui相关的几个包:minigui-res-be-3.0.12.tar, libmgutils-1.0.4, 实例包:mg-samples-3.0.12
3.需先安装Minigui所需的支持包,按顺序安装为:zlib,freetype,jpeg,png, MiniGui resource, MiniGui核心库, MiniGui Utils
======================================
安装zlib
#tar -zxvf zlib-1.2.2.tar.gz
#cd zlib-1.2.2
#./configure --prefix="zlib要安装的目录" --shared
编辑Makefile
将文件中的 几个变量定义修改为 如下
CC=arm-none-linux-gnueabi-gcc
CFLAGS=-fPIC -O3 -DUSE_MMAP -Wall -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include
LDFLAGS=-L. libz.so.1.2.2
LDSHARED=arm-none-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1
CPP=arm-none-linux-gnueabi-gcc -E
LIBS=libz.so.1.2.2
AR=arm-none-linux-gnueabi-ar rc
prefix =zlib要安装的目录
#make clean
#make all
#make install
======================================
安装freetype
#tar -zxvf freetype-2.3.9-fm20100818.tar.gz
#cd freetype-2.3.9-fm20100818
执行如下,其中 arm-none-linux-gnueabi 为 arm-2009q1-203 安装后设置的目录
freetype要安装的目录,比如 /opt/arm/minigui/target
#./configure --prefix="freetype要安装的目录" --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnulibc1 --enable-shared --with-gnu-ld --without-zlib CFLAGS="-g -O2 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include"
如果顺利,将见到如下提示:make: Nothing to be done for `unix'.
然后执行:
#make clean
#make all
如果顺利,将见到如下提示:
libtool: link: arm-none-linux-gnueabi-ranlib 安装目标目录/minigui/freetype-2.3.9-fm20100818/objs/.libs/libfreetype.a
libtool: link: ( cd "安装目标目录/minigui/freetype-2.3.9-fm20100818/objs/.libs" && rm -f "libfreetype.la" && ln -s "../libfreetype.la" "libfreetype.la" )
最后执行install
#make install
进入目标路径,执行tree看目录结构如下:
.
├── bin
│?? └── freetype-config
├── include
│?? ├── freetype2
│?? │?? └── freetype
│?? │?? ├── config
│?? │?? │?? ├── ftconfig.h
│?? │?? │?? ├── ftheader.h
│?? │?? │?? ├── ftmodule.h
│?? │?? │?? ├── ftoption.h
│?? │?? │?? └── ftstdlib.h
│?? │?? ├── freetype.h
│?? │?? ├── ftadvanc.h
│?? │?? ├── ftbbox.h
│?? │?? ├── ftbdf.h
│?? │?? ├── ftbitmap.h
│?? │?? ├── ftcache.h
│?? │?? ├── ftchapters.h
│?? │?? ├── ftcid.h
│?? │?? ├── fterrdef.h
│?? │?? ├── fterrors.h
│?? │?? ├── ftgasp.h
│?? │?? ├── ftglyph.h
│?? │?? ├── ftgxval.h
│?? │?? ├── ftgzip.h
│?? │?? ├── ftimage.h
│?? │?? ├── ftincrem.h
│?? │?? ├── ftlcdfil.h
│?? │?? ├── ftlist.h
│?? │?? ├── ftlzw.h
│?? │?? ├── ftmac.h
│?? │?? ├── ftmm.h
│?? │?? ├── ftmodapi.h
│?? │?? ├── ftmoderr.h
│?? │?? ├── ftotval.h
│?? │?? ├── ftoutln.h
│?? │?? ├── ftpfr.h
│?? │?? ├── ftrender.h
│?? │?? ├── ftsizes.h
│?? │?? ├── ftsnames.h
│?? │?? ├── ftstroke.h
│?? │?? ├── ftsynth.h
│?? │?? ├── ftsystem.h
│?? │?? ├── fttrigon.h
│?? │?? ├── fttypes.h
│?? │?? ├── ftwinfnt.h
│?? │?? ├── ftxf86.h
│?? │?? ├── t1tables.h
│?? │?? ├── ttnameid.h
│?? │?? ├── tttables.h
│?? │?? ├── tttags.h
│?? │?? └── ttunpat.h
│?? └── ft2build.h
├── lib
│?? ├── libfreetype.a
│?? ├── libfreetype.la
│?? ├── libfreetype.so -> libfreetype.so.6.3.20
│?? ├── libfreetype.so.6 -> libfreetype.so.6.3.20
│?? ├── libfreetype.so.6.3.20
│?? └── pkgconfig
│?? └── freetype2.pc
└── share
└── aclocal
└── freetype2.m4
其中 includ 和 lib 即是所需的。
如果make遇到问题,请检查如下几个文件:
exports.mk ,确保 如下2行,有包含 gcc (注意,是 x86的 gcc )的include路径
INCLUDE_DIR_GCC := -I/usr/include
$(APINAMES_EXE): $(APINAMES_SRC)
$(CCexe) $(INCLUDE_DIR_GCC) $(TE)$@ $<
builds/unix 下的 unix-cc.mk 文件中如下几行:
CC := arm-none-linux-gnueabi-gcc
CFLAGS := -c -g -O2 -Iarm-none-linux的include路径
builds/unix 下的 libtool 文件中如下几行:
OBJDUMP=arm-none-linux-gnueabi-objdump
host_alias=arm-none-linux-gnueabi
host=arm-none-linux-gnueabi
host_os=linux-gnueabi
build_alias=i686-pc-linux-gnulibc1
build=i686-pc-linux-gnulibc1
build_os=linux-gnulibc1
NM="/opt/arm-2009q1-203/bin/arm-none-linux-gnueabi-nm -B"
max_cmd_len=805306365
AR="arm-none-linux-gnueabi-ar"
STRIP="arm-none-linux-gnueabi-strip"
RANLIB="arm-none-linux-gnueabi-ranlib"
LTCC="arm-none-linux-gnueabi-gcc"
LTCFLAGS="-g -O2 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include"
SHELL="/bin/sh"
sys_lib_search_path_spec="/opt/arm-2009q1-203/lib/gcc/arm-none-linux-gnueabi/4.3.3 /opt/arm-2009q1-203/lib/gcc /opt/arm-2009q1-203/arm-none-linux-gnueabi/lib /opt/arm-2009q1-203/arm-none-linux-gnueabi/libc/lib /opt/arm-2009q1-203/arm-none-linux-gnueabi/libc/usr/lib"
sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/mesa /opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include /opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include-fixed /opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include /opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib /usr/lib/vmware-tools/lib32/libvmGuestLib.so /usr/lib/vmware-tools/lib64/libvmGuestLib.so /usr/lib/vmware-tools/lib32/libvmGuestLibJava.so /usr/lib/vmware-tools/lib64/libvmGuestLibJava.so /usr/lib/vmware-tools/lib32/libDeployPkg.so /usr/lib/vmware-tools/lib64/libDeployPkg.so "
old_striplib="arm-none-linux-gnueabi-strip --strip-debug"
striplib="arm-none-linux-gnueabi-strip --strip-unneeded"
LD="/opt/arm-2009q1-203/arm-none-linux-gnueabi/bin/ld"
CC="arm-none-linux-gnueabi-gcc"
========================================
安装 jpeg 库
#tar -zxf jpegsrc.v7.tar.gz
#cd jpeg-7
#./configure --prefix="jpeglib要安装的目录" --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnulibc1 --enable-shared --with-gnu-ld CFLAGS="-g -O2 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include"
#make clean
#make all
#make install
libjpeg 安装过程相对比较简单和顺利
========================================
安装 png 库
#tar -zxf libpng-1.2.37.tar.gz
#cd libpng-1.2.37
#./configure --prefix="pnglib要安装的目录" --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnulibc1 --enable-shared --with-gnu-ld CFLAGS="-g -O2 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include -I已成功生成的zlib头文件目录" LIBS="-L已成功生成的zlib库所在目录"
#make clean
#make all
#make install
libpng 安装相对比较简单,可能会遇到的问题是需要依赖于 zlib,只要指定正确的有效的zlib 的include 和lib所在目录即可
========================================
安装 minigui res 库
#tar -zxvf
打开 configure文件,在文件开始增加如下
## set cross compiler
CC=arm-none-linux-gnueabi-gcc
CXX=arm-none-linux-gnueabi-g++
LD=arm-none-linux-gnueabi-ld
AS=arm-none-linux-gnueabi-as
AR=arm-none-linux-gnueabi-ar
保存退出
#./configure --prefix=minigui resource要安装的目录
#make clean
#make all
#make install
成功后,进入 安装的minigui res安装目录,执行tree将看到如下的目录结构
#tree
.
├── aclocal
│?? └── freetype2.m4
├── man
│?? ├── man1
│?? │?? ├── cjpeg.1
│?? │?? ├── djpeg.1
│?? │?? ├── jpegtran.1
│?? │?? ├── rdjpgcom.1
│?? │?? └── wrjpgcom.1
│?? ├── man3
│?? │?? ├── libpng.3
│?? │?? ├── libpngpf.3
│?? │?? └── zlib.3
│?? └── man5
│?? └── png.5
└── minigui
└── res
├── bmp
│?? ├── classic_check_button.bmp
│?? ├── classic_radio_button.bmp
│?? ├── fashion_check_btn.bmp
│?? ├── fashion_radio_btn.bmp
│?? ├── flat_check_button.bmp
│?? ├── flat_radio_button.bmp
│?? ├── skin_arrows.gif
│?? ├── skin_arrows_shell.bmp
│?? ├── skin_bborder.bmp
│?? ├── skin_bkgnd.bmp
│?? ├── skin_caption.gif
│?? ├── skin_checkbtn.bmp
│?? ├── skin_cpn_btn.gif
│?? ├── skin_header.bmp
│?? ├── skin_lborder.bmp
│?? ├── skin_pb_htrack.gif
│?? ├── skin_pb_htruck.bmp
│?? ├── skin_pb_vtrack.gif
│?? ├── skin_pb_vtruck.bmp
│?? ├── skin_pushbtn.gif
│?? ├── skin_radiobtn.gif
│?? ├── skin_rborder.bmp
│?? ├── skin_sb_arrows.bmp
│?? ├── skin_sb_hshaft.bmp
│?? ├── skin_sb_hthumb.bmp
│?? ├── skin_sb_vshaft.bmp
│?? ├── skin_sb_vthumb.bmp
│?? ├── skin_tab.gif
│?? ├── skin_tb_horz.gif
│?? ├── skin_tborder.bmp
│?? ├── skin_tbslider_h.gif
│?? ├── skin_tbslider_v.gif
│?? ├── skin_tb_vert.gif
│?? └── skin_tree.bmp
├── cursor
│?? ├── d_arrow.cur
│?? ├── d_beam.cur
│?? ├── d_busy.cur
│?? ├── d_cross.cur
│?? ├── d_help.cur
│?? ├── d_move.cur
│?? ├── d_none.cur
│?? ├── d_pencil.cur
│?? ├── d_sizenesw.cur
│?? ├── d_sizens.cur
│?? ├── d_sizenwse.cur
│?? ├── d_sizewe.cur
│?? ├── d_uparrow.cur
│?? ├── d_wait.cur
│?? ├── g_arrow.cur
│?? ├── g_col.cur
│?? ├── g_drag.cur
│?? ├── g_help.cur
│?? ├── g_maginify.cur
│?? ├── g_move.cur
│?? ├── g_nodrop.cur
│?? ├── g_pencil.cur
│?? ├── g_rarrow.cur
│?? ├── g_row.cur
│?? ├── g_sizenesw.cur
│?? ├── g_sizens.cur
│?? ├── g_sizenwse.cur
│?? ├── g_sizewe.cur
│?? ├── h_cross.cur
│?? ├── h_ibeam.cur
│?? ├── h_move.cur
│?? ├── h_ne.cur
│?? ├── h_nodrop.cur
│?? ├── h_ns.cur
│?? ├── h_nw.cur
│?? ├── ho_line.cur
│?? ├── ho_sizeb.cur
│?? ├── ho_split.cur
│?? ├── h_point.cur
│?? ├── h_select.cur
│?? ├── h_we.cur
│?? ├── ve_line.cur
│?? ├── ve_sizeb.cur
│?? └── ve_split.cur
├── font
│?? ├── 6x12-iso8859-1.bin
│?? ├── 8x16-iso8859-1.bin
│?? ├── courier-mr-10.upf
│?? ├── courier-mr-12.upf
│?? ├── courier-mr-14.upf
│?? ├── courier-mr-18.upf
│?? ├── courier-mr-24.upf
│?? ├── courier-mr-8.upf
│?? ├── Courier-rr-10-15.vbf
│?? ├── Courier-rr-8-13.vbf
│?? ├── fmfsong-latin-gb2312-12.upf
│?? ├── fmfsong-latin-gb2312-16.upf
│?? ├── fmhei-latin-gbk-16.upf
│?? ├── fmkai-latin-gb2312-12.upf
│?? ├── fmkai-latin-gb2312-16.upf
│?? ├── fmsong-latin-gbk-12.upf
│?? ├── fmsong-latin-gbk-16.upf
│?? ├── font.name
│?? ├── helvetica-mr-10.upf
│?? ├── helvetica-mr-12.upf
│?? ├── helvetica-mr-14.upf
│?? ├── helvetica-mr-18.upf
│?? ├── helvetica-mr-24.upf
│?? ├── helvetica-mr-8.upf
│?? ├── Helvetica-rr-11-12.vbf
│?? ├── Helvetica-rr-15-16.vbf
│?? ├── lucida-mr-10.upf
│?? ├── lucida-mr-12.upf
│?? ├── lucida-mr-14.upf
│?? ├── lucida-mr-18.upf
│?? ├── lucida-mr-19.upf
│?? ├── lucida-mr-24.upf
│?? ├── lucida-mr-8.upf
│?? ├── micro_40_50.upf
│?? ├── smoothtimes_100_50.upf
│?? ├── song-12-gb2312.bin
│?? ├── song-16-gb2312.bin
│?? ├── times-mr-10.upf
│?? ├── times-mr-12.upf
│?? ├── times-mr-14.upf
│?? ├── times-mr-18.upf
│?? ├── times-mr-24.upf
│?? ├── times-mr-8.upf
│?? ├── Times-rr-10-12.vbf
│?? ├── Times-rr-13-15.vbf
│?? └── unifont_160_50.upf
└── icon
├── excalmatory-flat.ico
├── excalmatory.ico
├── failed-flat.ico
├── failed.ico
├── folder-flat.ico
├── folder.ico
├── fold-flat.ico
├── fold.ico
├── form-flat.ico
├── form.ico
├── help-flat.ico
├── help.ico
├── textfile-flat.ico
├── textfile.ico
├── unfold-flat.ico
├── unfold.ico
├── warning-flat.ico
└── warning.ico
====================================
安装Minigui 核心库
#tar -zxvf libminigui-gpl-3.0.12.tar
#cd libminigui-gpl-3.0.12
#./configure --prefix=libminigui核心库所需安装的目标目录 --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnulibc1 --with-osname=linux --with-targetname=fbcon --disable-screensaver --enable-autoial --enable-ttfcache --disable-vbfsupport --disable-videoqvfb --disable-pcxvfb --enable-standalone --enable-ctrltextedit --with-licensepicture=minigui --with-gnu-ld --with-ttfcachesize=1024 --with-mttfcachenum=40 CFLAGS="-g -O3 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include -IMinigui安装后的include目录 " LIBS="-L'zlib,freetype, jpg, pnglib等安装的lib目录'" CPPFLAGS="-g -I'zlib,freetype, jpg, pnglib等安装的include目录' -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include "
其中LIBS 变量增加 zlib,freetype, jpg, pnglib等安装的lib目录
CPPFLAGS 要有 zlib,freetype, jpg, pnglib等安装的include目录
其他开关,可通过 执行 configure --help 获取具体的参数和定义
#make clean
#make all
#make install
====================================
安装Utils
#tar -zxvf libmgutils-1.0.4.tar
#cd libmgutils-1.0.4
#./configure --prefix="utils要安装的目标目录" --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnulibc1 --with-gnu-ld CFLAGS="-g -O3 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include -Iminigui安装目录/include " LIBS=" -ldl -Lminigui安装目录/lib" CPPFLAGS="-g -I-IMinigui安装后的include目录 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include " MINIGUI_CFLAGS="-I-IMinigui安装后的include目录/include/minigui " MINIGUI_LIBS="-L'zlib,freetype, jpg, pnglib等安装的lib目录' -lminigui_sa -lpng -ljpeg -lfreetype "
编辑 ./Makefile 文件
需要修改 Makefile中的定义为如下:
CC=arm-none-linux-gnueabi-gcc
CPP=arm-none-linux-gnueabi-gcc
CXX=arm-none-linux-gnueabi-g++
LD=arm-none-linux-gnueabi-ld
AS=arm-none-linux-gnueabi-as
AR=arm-none-linux-gnueabi-ar
#make clean
#make all
#make install
====================================
以上已经安装了Minigui3.0.12所需的全部依赖库和核心库,下面通过安装minigui实例包:mg-samples-3.0.12来验证以上安装是否正确
#tar -zxvf mg-samples-3.0.12.tar
#cd mg-samples-3.0.12
#./configure --prefix=/mnt/hgfs/sharedir/minigui/mg-samples-3.0.12/target --host=arm-none-linux-gnueabi --build=i686-pc-linux-gnulibc1 --with-lang=en/zhcn CFLAGS="-g -O3 -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include -Iminigui安装目录/include " LIBS=" -ldl -Lminigui安装目录/lib" CPPFLAGS="-g -Iminigui安装目录/include -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include " MINIGUI_CFLAGS="-Iminigui安装目录/include/minigui " MINIGUI_LIBS="-Lminigui安装目录/lib -lminigui_sa -lpng -ljpeg -lfreetype -lpthread "
修改 ./Makefile 文件,增加如下定义:
CC=arm-none-linux-gnueabi-gcc
CPP=arm-none-linux-gnueabi-gcc
CXX=arm-none-linux-gnueabi-g++
LD=arm-none-linux-gnueabi-ld
AS=arm-none-linux-gnueabi-as
AR=arm-none-linux-gnueabi-ar
CFLAGS="-Iminigui安装目录/include -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include "
CPPFLAGS="-g -Iminigui安装目录/include -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include "
CXXFLAGS="-g -Iminigui安装目录/include -I/opt/arm-2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/include -I/opt/arm-2009q1-203/bin/../arm-none-linux-gnueabi/libc/usr/include "
LDFLAGS=-Lminigui安装目录/lib
LIBS = -lminigui_ths -ljpeg -lm -lpthread -ldl -lpng
执行make