Compile libjpeg and libpng

Source: Internet
Author: User

 

Please indicate the source when reprint: http://blog.csdn.net/absurd

 

I. JPEG library cross-Compilation

 

1. Basic information:

Software name
Libjpeg
 
Function Description
Libjpeg: a JPEG image encoding and decoding library
 

Http://www.ijg.org/files/jpegsrc.v8a.tar.gz

Http://www.photopost.com/jpegsrc.v6b.tar.gz --- do not download from here

 

Note: Please download the latest version from the first website. I have always compiled v6b with an error. Switch to v8a and pass it normally.
 
Software Version
Jpegsrc.v8a.tar.gz
 
Dependency
Default
 
Prerequisites
Source File Location: $ (work_dir)/jpeg-6b
 

 

2. Process Analysis

For the stable version to be downloaded, configure already exists and you can directly configure it:

[Root @ Linux jpeg-6b] #./configure -- Host = arm-Linux -- prefix =/root/lib/libjpeg-enable-share-enable-static

 

OK. The configuration is successful. Compile:

[Root @ Linux jpeg-6b] # Make & make install

 

Oh, no. Why is it compiled with GCC instead of arm-Linux-GCC? It seems that -- the host does not take effect. Try the old method-set the CC environment variable:

[Root @ Linux jpeg-6b] # export cc = arm-Linux-gcc

[Root @ Linux jpeg-6b] #./configure -- Host = $ arch-Linux -- prefix = $ rootfs_dir/usr

 

OK. The configuration is successful. Compile:

[Root @ Linux jpeg-6b] # Make & make install

 

OK. The compilation is successful.

 

3. Build prescriptions

L jpeg. mk

 

Export _dir = "jpeg-6b"

 

ALL: Clean config build

 

Config:

@ CD $ (cmd_dir )&&/

Export cc = arm-Linux-GCC &&/

./Configure -- prefix =$ $ rootfs_dir/usr &&/

Echo "Config done"

Build:

@ CD $ (cmd_dir )&&/

Make & make install &&/

Echo "build done"

Clean:

@ CD $ (cmd_dir )&&/

If [-e makefile]; then make distclean; fi &&/

Echo "clean done"

 

 

4. After completing all the above steps, you can copy the Library to the Development Board to display JPEG images. A simple example is provided!

 

 

 

Ii. Cross-Compilation of PNG Libraries

 

1. Basic information:

Software name
Libpng
 
Function Description
Libpng a PNG image encoding and decoding library
 

Http://www.libpng.org/pub/png/libpng.html
 
Software Version
Libpng-1.2.8-config.tar.gz
 
Dependency
Default

Zlib
 
Prerequisites
Source File Location: $ (work_dir)/libpng-1.2.8-config
 

 

2. Process Analysis

For the stable version to be downloaded, configure already exists and you can directly configure it:

[Root @ Linux libpng-1.2.8-config] #./configure -- Host = $ arch-Linux -- prefix = $ rootfs_dir/usr

The following error occurs:

Configure: Error: zlib Not Installed

 

It's strange that zlib has been compiled. Why can't configure find zlib? Set the environment variables cflags and ldflags. makefile generally uses cflags to set additional compilation options and ldflags to set additional connection options. Configure follows this rule.

[Root @ Linux libpng-1.2.8-config] # export ldflags =-L $ rootfs_dir/usr/local/lib

[Root @ Linux libpng-1.2.8-config] # export cflags =-I $ rootfs_dir/usr/local/include

[Root @ Linux libpng-1.2.8-config] #./configure -- Host = $ arch-Linux -- prefix = $ rootfs_dir/usr

 

OK. The configuration is successful. Compile:

[Root @ Linux libpng-1.2.8-config] # Make & make install

OK. The compilation is successful.

 

3. Build prescriptions

L PNG. mk

 

Png_dir = "libpng-1.2.8-config"

 

ALL: Clean config build

 

Config:

@ CD $ (png_dir )&&/

Export ldflags =-L $ rootfs_dir/usr/local/lib &&/

Export cflags =-I $ rootfs_dir/usr/local/include &&/

./Configure -- Host =$ $ arch-Linux -- prefix =$ $ rootfs_dir/usr & amp &&/

Echo "Config done"

Build:

@ CD $ (png_dir )&&/

Make & make install &&/

Echo "build done"

Clean:

@ CD $ (png_dir )&&/

If [-e makefile]; then make distclean; fi &&/

Echo "clean done"

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/absurd/archive/2006/04/01/646546.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.