天天看點

交叉編譯libjpeg

fedora9

arm-linux-4.3.2

提前工作閱讀README

-->Please read at least the files install.doc and usage.doc.

1. 下載下傳libjpeg源碼:

http://download.chinaunix.net/download.php?id=10021&ResourceID=5095

ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz  

解壓進入目錄   配置

[[email protected] jpeg-6b]# ./configure --prefix=/root/libjpeg-arm  --exec-prefix=/root/libjpeg-arm --enable-shared --enable-static

checking for gcc... gcc

checking whether the C compiler (gcc  ) works... yes

checking whether the C compiler (gcc  ) is a cross-compiler... no

checking whether we are using GNU C... yes

checking how to run the C preprocessor... gcc -E

checking for function prototypes... yes

checking for stddef.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for size_t... yes

checking for type unsigned char... yes

checking for type unsigned short... yes

checking for type void... yes

checking for working const... yes

checking for inline... __inline__

checking for broken incomplete types... ok

checking for short external names... ok

checking to see if char is signed... yes

checking to see if right shift is signed... yes

checking to see if fopen accepts b spec... yes

checking for a BSD compatible install... /usr/bin/install -c

checking for ranlib... ranlib

checking host system type... i686-pc-linux-gnu

checking for ranlib... ranlib

checking for gcc... gcc

checking whether we are using GNU C... yes

checking for gcc option to produce PIC... -fPIC

checking if gcc PIC flag -fPIC works... yes

checking if gcc static flag -static works... -static

checking whether ln -s works... yes

checking for ld used by GCC... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking whether the linker (/usr/bin/ld) supports shared libraries... yes

checking for BSD-compatible nm... /usr/bin/nm -B

checking command to parse /usr/bin/nm -B output... yes

checking how to hardcode library paths into programs... immediate

checking for /usr/bin/ld option to reload object files... -r

checking dynamic linker characteristics... Linux ld.so

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

checking for objdir... .libs

creating libtool

checking libjpeg version number... 62

creating ./config.status

creating Makefile

creating jconfig.h

[[email protected] jpeg-6b]# vi Makefile 

......

# Where to install the programs and man pages.

prefix = /root/libjpeg-arm

exec_prefix = /root/libjpeg-arm

bindir = $(exec_prefix)/bin

libdir = $(exec_prefix)/lib

includedir = $(prefix)/include

binprefix =

manprefix =

manext = 1

mandir = $(prefix)/man/man$(manext)

# The name of your C compiler:

CC= /usr/local/arm/4.3.2/bin/arm-linux-gcc

# You may need to adjust these cc options:

......

# library (.a) file creation command

AR= /usr/local/arm/4.3.2/bin/arm-linux-ar rc

# second step in .a creation (use "touch" if not needed)

AR2= /usr/local/arm/4.3.2/bin/arm-linux-ranlib

# installation program

.......

2.在/root/libjpeg-arm   目錄下建立 man/man1,include,lib,bin四個目錄

# make

# make install

3.将/root/libjpeg-arm/include/中(jconfig.h, jerror.h, jmorecfg.h, jpeglib.h)四個頭檔案拷貝到:/usr/local/arm/4.3.2/arm-none-linux-gnueabi/include/中。

[[email protected] include]# ls

jconfig.h  jerror.h  jmorecfg.h  jpeglib.h

[[email protected] include]# vi jconfig.h 

[[email protected] include]# cp j* /usr/local/arm/4.3.2/arm-none-linux-gnueabi/include/

[[email protected] include]# ls /usr/local/arm/4.3.2/arm-none-linux-gnueabi/include/

c++  jconfig.h  jerror.h  jmorecfg.h  jpeglib.h

将/root/libjpeg-arm/lib中(libjpeg.la, libjpeg.so, libjpeg.so.62, libjpeg.so.62.0.0)四個庫檔案拷貝到:/usr/local/arm/4.3.2/arm-none-linux-gnueabi/lib/中

[[email protected] lib]# file libjpeg.so.62.0.0 

libjpeg.so.62.0.0: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), not stripped

[[email protected] lib]# ls

libjpeg.a  libjpeg.la  libjpeg.so  libjpeg.so.62  libjpeg.so.62.0.0

[[email protected] lib]# cp libjpeg.la libjpeg.so libjpeg.so.62 libjpeg.so.62.0.0 /usr/local/arm/4.3.2/arm-none-linux-gnueabi/lib

[[email protected] lib]# ls /usr/local/arm/4.3.2/arm-none-linux-gnueabi/lib

armv4t  ldscripts   libjpeg.so     libjpeg.so.62.0.0  thumb2

boards  libjpeg.la  libjpeg.so.62  libsupc++.a

注意:執行完以上操作後執行以下指令檢查庫檔案是否已正确安裝:

# arm-linux-gcc -print-file-name=libjpeg.so 

如果輸出為"libjpeg.so"則說明沒有正确安裝,重複7步驟。

如果輸出為"DIR/libjpeg.so"則說明安裝正确。

至此libjpeg交叉編譯完成。

[roo[email protected] lib]# arm-linux-gcc -print-file-name=libjpeg.so

/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/lib/libjpeg.so

deebug

20140225

ccnu

繼續閱讀