分类:
2011-03-21 11:38:54
step2:
#cd ./jpeg-6b
#./configure --prefix=/home/jpeg_arm --exec-prefix=/home/jpeg_arm --enable-shared --enable-static
下面分别介绍这几个参数的作用:
--prefix=/home/jpeg_arm/include : 执行make install 后,会将与体系无关的文件拷贝到此目录下,具体如下:
/home/jpeg_arm_include.....................................
|
+---include........................................
|
---jconfig.h
|
---jerror.h
|
---jmorecfg.h
|
---jpeglib.h
+---man............................................
|
+---man1.......................................
|
---cjeg.1
|
---djpeg.1
|
---jpegtran.1
|
---rdjpgcom.1
|
---wrjpgcom.1
--exec-prefix=/home/jpeg_arm/lib : 执行make install 后,会将与体系无关的文件拷贝到此目录下,即将一些可执行程序、动态链接库和静态链接库拷贝到此目录的相应目录下,具体如下:
/home/jpeg_arm_lib........................................
|
+---bin............................................
|
---cjeg
|
---djpeg
|
---jpegtran
|
---rdjpgcom
|
---wrjpgcom
+---lib...........................................
|
---libjpeg.la
|
---libjpeg.so
|
---libjpeg.so.62
|
---libjpeg.so.62.0.0
--enable-shared : 用GNU libtool编译成动态链接库 。下面分别对应有无此参数所生成的Makefile的比较:
-------------------------------------------------------------------------------------------
无--enable-shared参数 | 有--enable-shared参数
-------------------------------------------------------------------------------------------
LIBTOOL = | LIBTOOL = ./libtool
-------------------------------------------------------------------------------------------
O = o A = a | O = lo A = la
-------------------------------------------------------------------------------------------
LN= $(CC) | LN= $(LIBTOOL) --mode=link $(CC)
-------------------------------------------------------------------------------------------
INSTALL_PROGRAM= ${INSTALL} | INSTALL_PROGRAM= $(LIBTOOL) --mode=install ${INSTALL}
INSTALL_LIB= ${INSTALL} -m 644 | INSTALL_LIB= $(LIBTOOL) --mode=install ${INSTALL}
-------------------------------------------------------------------------------------------------------
无参数:
# $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c
有参数:
.c.lo:
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$*.c
----------------------------------------------------------------------------------------------------------
无参数:
install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom
有参数:
install: cjpeg djpeg jpegtran rdjpgcom wrjpgcom install-lib
-----------------------------------------------------------------------------------------------------------
step3:修改生成的Makefile文件:
# The name of your C compiler:
CC= gcc 该成 CC=arm-linux-gcc (根据你自己交叉编译器的位置修改)
# library (.a) file creation command
AR= ar rc 该成 AR=arm-linux-ar rc (同上)
# second step in .a creation (use "touch" if not needed)
AR2= ranlib 该成 AR2=arm-linux-/ranlib (同上)
step4:sudo mkdir /home/jpeg_arm
sudo mkdir /home/jpeg_arm/lib
sudo mkdir /home/jpeg_arm/include
sudo mkdir /home/jpeg_arm/man
sudo mkdir /home/jpeg_arm/lib/man/man1
step5:#make
#sudo make install
这样JPEG库就交叉编译成功了,相应的库和头文件都在/home/jpeg_arm/lib和/home/jpeg_arm/include下了!
在编写应用程序在编译时记得加上 -ljpeg