Chinaunix首页 | 论坛 | 博客
  • 博客访问: 375010
  • 博文数量: 57
  • 博客积分: 2299
  • 博客等级: 大尉
  • 技术积分: 1109
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-27 23:12
文章分类
文章存档

2011年(4)

2010年(53)

分类: 嵌入式

2010-03-10 16:52:33

1、下载如下几个文件
文件: libminigui-1.6.10.tar.gz
大小: 2721KB
下载: 下载
文件: mg-samples-1.6.10.tar.gz
大小: 564KB
下载: 下载
文件: minigui-res-1.6.10.tar.gz
大小: 2887KB
下载: 下载
arm-linux-gcc版本 4.3.3
目录如下:

[root@localhost minigui]# ls -al
总计 6820
drwxrwxrwx 6 root root 4096 03-07 23:53 .
drwxr-x--- 51 root root 4096 03-10 15:53 ..
drwxrwxrwx 8 1000 1000 4096 03-10 15:53 libminigui-1.6.10
-rwxrwxrwx 1 root root 2786624 2008-03-06 libminigui-1.6.10.tar.gz
-rwxrwxrwx 1 root root 607273 2008-03-06 mde-1.6.10.tar.gz
drwxrwxrwx 4 1000 1000 4096 03-08 00:06 mg-samples-1.6.10
-rwxrwxrwx 1 root root 577762 2008-03-06 mg-samples-1.6.10.tar.gz
drwxr-xr-x 7 1000 1000 4096 03-07 23:19 minigui-res-1.6.10
-rwxrwxrwx 1 root root 2956865 2008-03-06 minigui-res-1.6.10.tar.gz
drwxr-xr-x 6 root root 4096 03-10 14:22 tmp

2、解压libminigui-1.6.10.tar.gz,修改configure,在其首部加入以下内容:

CC=arm-linux-gcc
CPP=arm-linux-cpp
LD=arm-linux-ld
AR=arm-linux-ar
RANLIB=arm-linux-ranlib
STRIP=arm-linux-strip

然后执行

[root@localhost libminigui-1.6.10]# ./configure --prefix=/root/minigui/tmp/ \
> --host=arm-linux \
> --target=arm-linux
[root@localhost libminigui-1.6.10]#make; make install

install以后就会在tmp下生成etc、lib、usr等个文件夹,为下面的准备文件
然后进入到tmp/lib文件夹下执行

[root@localhost lib]# pwd
/root/minigui/tmp/lib
[root@localhost lib]# ldconfig

3、安装minigui-res-1.6.10.tar.gz,这个简单些,解压后进去修改config.linux第11行,修改成TOPDIR=/root/minigui/tmp/  然后make install就ok了

4、修改tmp/etc/MiniGUI.cfg这个文件,前面修改成如下几行

[system]
# GAL engine and default options
gal_engine=fbcon
defaultmode=320x240-16bpp

# IAL engine
ial_engine=console
mdev=none
mtype=none

[fbcon]
defaultmode=320x240-16bpp

[qvfb]
defaultmode=320x240-16bpp
display=0

其中mdev=none mtype=none由于暂时没有移植触摸屏,所以选择none,不然运行例程的时候会出现

InitGUI: Low level event initialization
InitGUI failure when using /etc/MiniGUI.cfg as cfg file.

这样的错误,改成mdev=none mtype=none就好了



5、添加库文件到板子上去,说明一下,我板子上的文件系统是yaffs2,不是ramdisk,所以可以通过终端修改文件系统内文件的内容,就不必每次修改了都在烧写文件系统或是用uboot通过tftp传ramdisk了,方便。现在要拷贝的库一些来自刚刚编译的tmp下的文件,一些来自交叉编译工具;链本身,都是需要从pc上拷贝到板子上,我的方法是先把需要的文件拷贝到pc上nfs的共享文件夹,再把此文件夹mount到板子上,然后从终端拷贝需要的文件到板子相应的文件里!他们的对应关系是   tmp/lib下的所有文件--->板子的/usr/lib;tmp/usr/local/lib/minigui整个文件夹--->板子/usr/local/lib/minigui 别忘了把tmp/etc/MiniGUI.cfg这个文件也拷贝到板子/etc下面,库就考完了……

6、编译例程:解压mg-samples-1.6.10.tar.gz并进入修改configure.in,第30行左右修改成AC_CHECK_HEADERS(/root/minigui/tmp/include/minigui/common.h, have_libminigui=yes, foo=bar)明显是指定头文件路径的;然后修改configure,添加如下

CC=arm-linux-gcc
CPP=arm-linux-cpp
LD=arm-linux-ld
AR=arm-linux-ar
RANLIB=arm-linux-ranlib
STRIP=arm-linux-strip

执行如下

[root@localhost mg-samples-1.6.10]# ./configure --prefix=/root/minigui/tmp/ \
> --host=arm-linux\
> --target=arm-linux

即可身生成Makefile等文件,修改src/Makefile,

-----198行
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -lminigui -lmgext -lm -lpthread -lpng -ljpeg
-------250行
CC = arm-linux-gcc -I /root/minigui/tmp/include -L /root/minigui/tmp/lib
-----252
CFLAGS =-O2
-----268行
LIBOBJS = -lminigui -lmgext -lm -lpthread -lpng -ljpeg
-----269行
LIBS = -lminigui -lmgext -lm -lpthread -lpng -ljpeg


今天出现了怪现象,configure以后修改src里面的Makefile,然后make,会check,然后在生成Makefile,以至配置不见了,故出现头文件找不到的情况,这个的好好细究一哈是怎么回事!!昨晚郁闷了,本来是要重新写个gui的,结果把时间花在编译上了……修改了src\Makefile后make出现的信息如下:

[root@localhost mg-samples-1.6.10]# make
cd . && /bin/sh /root/minigui-arm/mg-samples-1.6.10/missing --run aclocal-1.9
 cd . && /bin/sh /root/minigui-arm/mg-samples-1.6.10/missing --run automake-1.9 --gnu
cd . && /bin/sh /root/minigui-arm/mg-samples-1.6.10/missing --run autoconf
/bin/sh ./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure --prefix=/root/minigui-arm/tmp/ --host=arm-linux --target=arm-linux host_alias=arm-linux target_alias=arm-linux --no-create --no-recursion
configure: WARNING: If you wanted to set the --build type, don
't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-gnu
checking target system type... arm-unknown-linux-gnu
checking whether make sets $(MAKE)... yes
checking for arm-linux-gcc... arm-linux-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gcc accepts -g... yes
checking for arm-linux-gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking for style of include used by make... GNU
checking for arm-linux-strip... arm-linux-strip
checking dependency style of arm-linux-gcc... gcc3
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... arm-linux-gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking whether time.h and sys/time.h may both be included... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking /root/minigui-arm/tmp//include/minigui/common.h usability... yes
checking /root/minigui-arm/tmp//include/minigui/common.h presence... yes
checking for /root/minigui-arm/tmp//include/minigui/common.h... yes
checking whether __NOUNIX__ is declared... no
checking whether _MGRM_THREADS is declared... no
checking whether _MGRM_PROCESSES is declared... no
checking whether _MGRM_STANDALONE is declared... no
checking whether _USE_NEWGAL is declared... no
checking whether _HAVE_MATH_LIB is declared... no
checking whether _PNG_FILE_SUPPORT is declared... no
checking whether _PNG_FILE_SUPPORT is declared... (cached) no
checking whether _JPG_FILE_SUPPORT is declared... no
checking whether _TYPE1_SUPPORT is declared... no
checking whether _TTF_SUPPORT is declared... no
checking whether _FT2_SUPPORT is declared... no
configure: creating ./config.status
 /bin/sh ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/res/Makefile
config.status: executing depfiles commands
Making all in src
make[1]: Entering directory `/root/minigui-arm/mg-samples-1.6.10/src'

Making all in res
make[2]: Entering directory `/root/minigui-arm/mg-samples-1.6.10/src/res
'
make[2]: Nothing to be done for `all'
.
make[2]: Leaving directory `/root/minigui-arm/mg-samples-1.6.10/src/res
'
make[2]: Entering directory `/root/minigui-arm/mg-samples-1.6.10/src'

if arm-linux-gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"mg-samples\" -DVERSION=\"1.6.10\" -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE__ROOT_MINIGUI_ARM_TMP__INCLUDE_MINIGUI_COMMON_H=1 -DHAVE_DECL___NOUNIX__=0 -DHAVE_DECL__MGRM_THREADS=0 -DHAVE_DECL__MGRM_PROCESSES=0 -DHAVE_DECL__MGRM_STANDALONE=0 -DHAVE_DECL__USE_NEWGAL=0 -D_LANG_EN=1 -DHAVE_DECL__HAVE_MATH_LIB=0 -DHAVE_DECL__PNG_FILE_SUPPORT=0 -DHAVE_DECL__PNG_FILE_SUPPORT=0 -DHAVE_DECL__JPG_FILE_SUPPORT=0 -DHAVE_DECL__TYPE1_SUPPORT=0 -DHAVE_DECL__TTF_SUPPORT=0 -DHAVE_DECL__FT2_SUPPORT=0 -I. -I. -g -O2 -Wall -Wstrict-prototypes -pipe -MT helloworld.o -MD -MP -MF ".deps/helloworld.Tpo
" -c -o helloworld.o helloworld.c; \
        then mv -f "
.deps/helloworld.Tpo" ".deps/helloworld.Po"; else rm -f ".deps/helloworld.Tpo

可以看出是头文件路径发生了变化,从上面信息可以看出又生成了src/Makefile,打开一看,刚才修改的东西不见了,所以找不到头文件!!!!!!!!!!

经过几番尝试,发现需要打开mg-samples-1.6.10顶层目录下的Makefile一次,不管是在修改src/Makefile前还是后,打开一次保存即可,无需修改,然后在make……

不明白这是为什么,难道是要重新确定两个Makefile的修改时间?

make以后就可以在src下生成很多可执行文件,通过nfs mount到板子上,运行就可以看到helloword的界面了,嘿嘿!执行时可以会缺少一下png、JPEG的库文件,到交叉工具链的目录下拷贝到板子上的/usr/lib文件下即可,拷贝时注意用ls -al 查看文件的链接信息,cp时加上-a这个参数,以保证一摸一样!如下:

[root@localhost lib]# ls -al libpng12.so*
lrwxrwxrwx 1 root root 18 03-09 14:10 libpng12.so -> libpng12.so.0.38.0
lrwxrwxrwx 1 root root 18 03-09 14:10 libpng12.so.0 -> libpng12.so.0.38.0

要拷贝libpng12.so 这个库,就要连同libpng12.so.0.38.0一起拷贝,使用命令cp -a libpng12.so……
阅读(3250) | 评论(0) | 转发(0) |
0

上一篇:加入自己的动态链接库

下一篇:短期目标

给主人留下些什么吧!~~