Port Madplay to fig

Source: Internet
Author: User
Port Madplay to-Linux general technology-Linux programming and kernel information. The following is a detailed description. 1. preparations.

Madplay porting requires the following packages: madplay-0.15.2b.tar.gz, libmad-0.15.1b.tar.gz, libid3tag-0.15.1b.tar.gz and zlib-1.1.4.tar.gz.

Http://sourceforge.net/project/showfiles.php? Group_id = 12349

Http://www.gzip.org/zlib/zlib-1.1.4.tar.gz

I use arm-linux-gcc 3.4.1. Many articles on the Internet use the arm-linux-gcc 2.95.3 cross compiler, but I'm using it to configure (. /configure) libid3tag, the last line of the old ingress configure file is wrong, check "config. log "for detail. No way. You have to use the 3.4.1 compiler.

2. compilation process.

(1) Compile zlib. I generate the Library to the library directory in the Cross-compilation environment, that is, put it under the/usr/local/arm/3.4.1/arm-linux directory .. /Configure -- prefix =/usr/local9/arm/3.4.1/arm-linux.

Modify the makefile file (which cannot be changed later:

CC =/usr/local/arm/3.4.1/bin/arm-linux-gcc
AR =/usr/local/arm/3.4.1/bin/arm-linux-ar rcs
RANLIB =/usr/local9/arm/3.4.1/bin/arm-linux-ranlib

Make, make install. After compilation, you can find the library libz. a In the lib directory specified by prefix above.

(2) Compile libid3tag

. /Configure CC =/usr/local/arm/3.4.1/bin/arm-linux-gcc -- prefix =/usr/local/arm/3.4.1/arm-linux -- host = arm- linux -- disable-debugging -- disable-shared -- enable-static CPPFLAGS =-I/usr/local/arm/3.4.1/arm-linux/include LDFLAGS =-L/usr/local/ arm/3.4.1/arm-linux/lib

Here, -- disable-shared -- enable-static is specified as static compilation. However, this cannot be compiled. As for why, further research is required.

Make, make install

(3) Compile libmad

. /Configure CC =/usr/local/arm/3.4.1/bin/arm-linux-gcc -- prefix =/usr/local9/arm/3.4.1/arm-linux -- host = arm- linux -- disable-debugging -- disable-shared -- enable-static CPPFLAGS =-I/usr/local9/arm/3.4.1/arm-linux/include LDFLAGS =-L/usr/local9/ arm/3.4.1/arm-linux/lib

Then, make, make install

(4) Compile madplay

. /Configure CC =/usr/local/arm/3.4.1/bin/arm-linux-gcc -- prefix =/usr/local/arm/3.4.1/arm-linux -- host = arm- linux -- disable-debugging -- disable-shared -- enable-static CPPFLAGS =-I/usr/local/arm/3.4.1/arm-linux/include LDFLAGS =-L/usr/local/ arm/3.4.1/arm-linux/lib

Then, make, make install

After the compilation is complete, check the size of the executable madplay file, which is only 236.8 K. It's so nice! Think again, it's impossible! I guess it should be because of the dynamic compilation, So I downloaded it to the board and tried it. input:

./Madplay

Error message:

./Madplay:/lib/libc. so.6: version 'glibc _ 100' not found (required by./madplay)

I was more sure that the above -- disable-shared -- enable-static parameter did not allow it to perform static compilation. Later I tried it with file madplay and output:

Madplay: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.3, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped

It is a dynamic compilation. What should I do? Read the error message carefully ----- No dynamic library. Simple! Copy several newly generated lib library files in the 3.4.1 compiler to the lib library of the Development Board. You can run it correctly.

3. issues left over.

How can we achieve dynamic compilation? The online documents indicate that the last compilation command output after make is added with-static, which is not clear! This will cause syntax errors. Then I tried it based on my own ideas, as shown below:

/Usr/local/arm/3.4.1/bin/arm-linux-gcc-Wall-O2-fomit-frame-pointer-o madplay. o getopt. o getopt1.o version. o resample. o filter. o tag. o crc. o rgain. o player. o audio. o audio_aiff.o audio_cdda.o audio_hex.o audio_null.o audio_raw.o audio_snd.o audio_wave.o audio-L/usr/local/arm/3.4.1/arm-linux/lib/usr/local/arm/3.4.1/arm-linux/lib/ libmad. a/usr/local/arm/3.4.1/arm-linux/lib/libid3tag. a-lz-lm-static

The last parameter static of the above command arm-linux-gcc was added by myself. After entering the above command on the terminal, the compilation will soon be completed. I will go to the madplay directory to check the madplay file size, more than 820 K !!!, That's good. I know it may be successful. I will download it to the board and input:./madplay only love.mp3.

Sound quality is good.

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.