Sunday, June 28, 2009

MinGW: Building Iconv 1.13.1 for Windows

Iconv is a character-set conversion tool. Iconv is useful by itself when you want to convert a text or HTML file from one encoding to another. The libiconv library is required by gettext, freetype and libcdio.

To build Iconv for Windows with MinGW compiler, download the Iconv source and compile iconv like this:

./configure --prefix=/mingw --disable-nls
make
make install

Iconv installs the following files on the system:

bin/iconv.exe
bin/libcharset-1.dll
bin/libiconv-2.dll
include/iconv.h
include/libcharset.h
include/localcharset.h
lib/libcharset.dll.a
lib/libcharset.la
lib/libcharset.a
lib/libiconv.dll.a
lib/libiconv.la
share/doc/libiconv
share/man/man1/iconv.1
share/man/man3/iconv*.3

Test: Execute the command iconv.exe --list in a Command Prompt.

Building Static LibIconv

Static libiconv is useful when you don't want your program looking for missing iconv.dll or libiconv-2.dll. Build a static version of libiconv like this:

./configure --prefix=/mingw --disable-shared --disable-nls
make
make install

Static build produces the following files:

bin/iconv.exe
include/iconv.h
include/libcharset.h
include/localcharset.h
lib/libcharset.a
lib/libcharset.la
lib/libiconv.a
lib/libiconv.la
share/doc/libiconv/

Here's my iconv.exe binary: iconv.exe

Building LibIconv with TDM-GCC

The procedure is the same as above except that you need to modify the WINDRES= line of src/Makefile.

WINDRES = windres -F pe-i386

For 64-bit build:

WINDRES = windres -F pe-x86-64

About This Blog

KBlog logo This blog seeks to provide useful information to people, based on the author's knowledge and experience. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Follow by Email

Total Pageviews