libjpeg的交叉編譯

轉自:  http://blog.csdn.net/ypist/article/details/8190966


http://www.ijg.org/files/網站下載lib庫的源文件.
開工:

  1. tar -xzvf jpeg-6b.tar.gz  
  2. cd jpeg-6b  
  3. mkdir /opt/jpeg/jpeg-6b-release  
  4. ./configure CC=arm-linux-gcc --prefix=/opt/jpeg/jpeg-6b-release --enable-shared --enable-static --host=arm-linux  
  5. mkdir /opt/jpeg/jpeg-6b-release/bin  
  6. mkdir /opt/jpeg/jpeg-6b-release/include  
  7. mkdir /opt/jpeg/jpeg-6b-release/lib  
  8. mkdir /opt/jpeg/jpeg-6b-release/man  
  9. mkdir /opt/jpeg/jpeg-6b-release/man/man1  
  10. make  


=================================================
出錯:

  1. [root@localhost jpeg-6b]# make  
  2. ./libtool --mode=compile arm-linux-gcc -O2  -I. -c ./jcapimin.c  
  3. make: ./libtool: Command not found  
  4. make: *** [jcapimin.lo] Error 127  

所以,我們得先安裝 libtool工具。
=================================================

   sudo yum install libtool libtool-ltdl libtool-ltdl-devel

或按 原帖主方法:

http://download.chinaunix.net/download/0007000/6039.shtml下載
得到: libtool-2.4.2.tar.xz
放到我們的Linux系統中:

網上說,tar.xz文件解壓 有2中辦法:
方式1:
    tar xvfJ ***.tar.xz
方式2:
    xz -d ***.tar.xz
    tar -xvf  ***.tar
我用方法1嘗試,報錯:

  1. [root@localhost jpeg]# tar xvfJ libtool-2.4.2.tar.xz  
  2. tar: invalid option -- J  
  3. Try `tar --help' or `tar --usage' for more information.  
  4. [root@localhost jpeg]# tar xvfj libtool-2.4.2.tar.xz  
  5. bzip2: (stdin) is not a bzip2 file.  
  6. tar: Child returned status 2  
  7. tar: Error exit delayed from previous errors  

於是,我採用方法2:
[root@localhost jpeg]# xz -d libtool-2.4.2.tar.xz
bash: xz: command not found
好吧, 我去給你安裝個xz工具,從 http://tukaani.org/xz/xz-4.999.9beta.tar.bz2
上面下載得到 xz-4.999.9beta.tar.bz2。
  1、tar -jxvf xz-4.999.9beta.tar.bz2
  2、cd xz-4.999.9beta
  3、./configure --prefix=/
  4、make && make install
OK, 去之前的目錄,然後 xz -d libtool-2.4.2.tar.xz
得到: libtool-2.4.2.tar
然後:tar -xvf libtool-2.4.2.tar
得到: libtool-2.4.2 文件夾。
$ cd libtool-2.2.4/ 

  1. [root@localhost libtool-2.4.2]# ./configure CC=arm-linux-gcc --host=arm-linux --build=arm-linux --prefix=/opt/jpeg/libtool-release   
  2. ## ------------------------- ##  
  3. ## Configuring libtool 2.4.2 ##  
  4. ## ------------------------- ##  
  5.   
  6. checking for a BSD-compatible install... /usr/bin/install -c  
  7. checking whether build environment is sane... yes  
  8. checking for a thread-safe mkdir -p... /bin/mkdir -p  
  9. checking for gawk... gawk  
  10. checking whether make sets $(MAKE)... yes  
  11. checking build system type... arm-unknown-linux-gnu  
  12. checking host system type... arm-unknown-linux-gnu  
  13. configure: autobuild project... GNU Libtool  
  14. configure: autobuild revision... 2.4.2 ()  
  15. configure: autobuild hostname... localhost.localdomain  
  16. configure: autobuild mode... default  
  17. configure: autobuild timestamp... 20121116T063533Z  
  18. checking for arm-linux-gcc... arm-linux-gcc  
  19. checking whether the C compiler works... yes  
  20. checking for C compiler default output file name... a.out  
  21. checking for suffix of executables...   
  22. checking whether we are cross compiling... configure: error: in `/opt/jpeg/libtool-2.4.2':  
  23. configure: error: cannot run C compiled programs.  
  24. If you meant to cross compile, use `--host'.  
  25. See `config.log' for more details  
  26.   
  27. 後來改爲:   
  28. [root@localhost libtool-2.4.2]# ./configure CC=arm-linux-gcc --host=arm-linux --prefix=/opt/jpeg/libtool-release   
  29. 配置通過。  

 

  1. $ make && make install    
  2. [root@localhost libtool-2.4.2]# ls ../libtool-release/bin  
  3. libtool  libtoolize  
  4. [root@localhost libtool-2.4.2]# cp ../libtool-release/bin/* ../jpeg-6b/  
  5. [root@localhost libtool-2.4.2]# cd ../jpeg-6b  
  6. ./configure CC=arm-linux-gcc --prefix=/opt/jpeg/jpeg-6b-release --enable-shared --enable-static --host=arm-linux  
  7. make && mak install  

 

至此,得到我們的文件在 jpeg-6b-release 目錄下面。

 

下面我們再延伸一下,將8d版本的庫也編譯了吧。

  1. [root@localhost jpeg]# cp /mnt/hgfs/jpeg_lib/jpegsrc.v8d.tar.gz ./  
  2. [root@localhost jpeg]# tar zxvf jpegsrc.v8d.tar.gz   
  3. [root@localhost jpeg-8d]# ./configure CC=arm-linux-gcc --prefix=/opt/jpeg/jpeg-8d-release --enable-shared --enable-static --host=arm-linux  
  4. [root@localhost jpeg-8d]# make && make install  
  5. [root@localhost jpeg-8d]# cd ../jpeg-8d-release/  
  6. [root@localhost jpeg-8d-release]# tree  
  7. .  
  8. |-- bin  
  9. |   |-- cjpeg  
  10. |   |-- djpeg  
  11. |   |-- jpegtran  
  12. |   |-- rdjpgcom  
  13. |   `-- wrjpgcom  
  14. |-- include  
  15. |   |-- jconfig.h  
  16. |   |-- jerror.h  
  17. |   |-- jmorecfg.h  
  18. |   `-- jpeglib.h  
  19. |-- lib  
  20. |   |-- libjpeg.a  
  21. |   |-- libjpeg.la  
  22. |   |-- libjpeg.so -> libjpeg.so.8.4.0  
  23. |   |-- libjpeg.so.8 -> libjpeg.so.8.4.0  
  24. |   `-- libjpeg.so.8.4.0  
  25. |-- man  
  26. |   `-- man1  
  27. |       |-- cjpeg.1  
  28. |       |-- djpeg.1  
  29. |       |-- jpegtran.1  
  30. |       |-- rdjpgcom.1  
  31. |       `-- wrjpgcom.1  
  32. `-- share  
  33.     `-- man  
  34.         `-- man1  
  35.             |-- cjpeg.1  
  36.             |-- djpeg.1  
  37.             |-- jpegtran.1  
  38.             |-- rdjpgcom.1  
  39.             `-- wrjpgcom.1  
  40.   
  41. 8 directories, 24 files  


 

至此, 我們的8d版本的JPEG庫也編譯通過了,哈哈。。

 



發佈了31 篇原創文章 · 獲贊 7 · 訪問量 20萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章