Monday, February 1, 2010

MinGW: To Compile LAME for Windows

LAME is a high-quality open-source MP3 encoder. Even though LAME is open-source, LAME is not freely distributed by some major Linux distributions, including Debian and Ubuntu. That's because there have been uncertain legal issues surrounding the MP3 algorithm. However, you can still download the LAME source and compile LAME using the free MinGW compiler. Following is an easy guide to compiling LAME for Windows.


The configure script of LAME makes use of nasm if found. To produce an optimal build of LAME, download yasm and save it as /mingw/bin/nasm.exe.


Launch MSYS (rxvt) and type the following command to unpack the LAME tarball.


tar xzvf lame-398-4.tar.gz

Go to the new folder lame-3.98.4 and configure LAME.


cd lame-3.98.4

./configure --prefix=/mingw --disable-shared --enable-expopt=full

Start compilation.


make

make install” will copy the following files into /mingw tree.


bin/lame.exe
bin/libmp3lame-0.dll
include/lame/
lib/libmp3lame.a
lib/libmp3lame.dll.a
lib/libmp3lame.la

What you definitely want is libmp3lame-0.dll and lame.exe. Copy them to a folder, for example, C:\Windows\System32 or C:\Windows.



To Make LAME_ENC.DLL


Even though the normal MinGW process creates a dynamic library named libmp3lame-0.dll, many Windows applications require a variant of LAME library called lame_enc.dll. Rather than hacking Makefiles, we can use a tool called a2dll from mingw-utils. mingw-utils is a package of tiny handy programs useful for MinGW users. Download mingw-utils-0.3.tar.gz and extract a2dll with tar or 7-zip.


After compiling LAME as shown above, open MSYS rxvt again and go to the folder that contains libmp3lame.a.


cd lame-3.98.4/libmp3lame/.libs

Then, run a2dll like this:


a2dll libmp3lame.a -o lame_enc.dll

You may append the -s option to get a leaner file lame_enc.dll. I tested lame_enc.dll I got this way with Audacity, and audacity was able to recognize lame_enc.dll and export to MP3 files. Yet, I need to do more testing with other programs, such as WinAMP, etc.



Related Posts


2 comments:

  1. Thank you for your tutorial on MinGW, that's really helpfull

    but this time it's (LAME) doesn't work, but I finally found a way, that is using Makefiles.mingw32 on DLL directory

    cd DLL && make -f Makefile.mingw32, and there's will have lame_enc.dll, and I can use it for audacity & Goldwave :) (Sorry for my english)

    ReplyDelete
  2. YES, YES, YES! Thank you! As a non-programmer I was struggling on this process with other websites. I followed to a T your instruction and had myself a lame_enc.dll within 10 minutes!!!! Thank you thank you thank you.!

    ReplyDelete

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger