step1:下載並解壓jpeg源代碼包
step2:
#cd ./jpeg-6b
#./configure --prefix=/home/jpeg_arm_include --exec-prefix=/home/jpeg_arm_lib /
--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}
-------------------------------------------------------------------------------------------------------
無參數:
# .c.lo:
# $(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=/usr/local/arm-linux/bin/arm-linux-gcc (根據你自己交叉編譯器的位置修改)
# library (.a) file creation command
AR= ar rc 該成 AR= /usr/local/arm-linux/arm-linux/bin/ar rc (同上)
# second step in .a creation (use "touch" if not needed)
AR2= ranlib 該成 AR2= /usr/local/arm-linux/arm-linux/bin/ranlib (同上)
step4:#make
#make install
這樣JPEG庫就交叉編譯成功了,相應的庫和頭文件都在/home/jpeg_arm_lib和/home/jpeg_arm_include下了!