Building the latest iconv and libxml2 binaries in Win32

眉间皱痕 提交于 2019-12-04 04:03:51

I realize that I may be reviving a dead thread, but...

Something that worked for me was to not compile the shared libs, instead deriving them using the a2dll tool as follows:

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

a2dll libiconv.a -o iconv.dll mv -iv iconv.dll /mingw/bin/

libxml2 provides JavaScript configure. Look for it in win32 folder. There also is a separate readme file there. Example of building libxml2:

cd win32
cscript.exe configure.js compiler=mingw prefix=D:\soft\Qt\2010.03\mingw  debug=yes static=yes
mingw32-make -f Makefile.mingw

I've downloaded prebuilt iconv and it works for me.

Environment mingw32

I was able to compile libxml2 with the help of this post
Inside the win32 directory of the unzipped
perform 2 steps as below

cscript configure.js threads:no static:yes compiler:mingw iconv:no prefix=where_you_want_to_install include=where_your_mingw_include_is lib=where_your_mingw_lib_is debug=yes

and then
mingw32-make -f Makefile.mingw

I was able to compile and execute example using code::blocks on mingw with Windows 7 environment.
Remember to specify -lxml2 and -lws2_32 flags in the "Other linker options" box under "Project build options"

you can get the binaries for windows made by Igor Zlatkovic at

you must make clean first then

./configure --host=arm-linux --disable-shared  --enable-static CC="arm-linux-gcc"  --prefix="/tmp/iconv" --with-configuredir="/tmp/iconv" 
make install 

then at the /tmp/iconv get the libconv.a

I have recently found a tutorial from Andrew Marlow (July 2013), explaining briefly how to compile libxml2 under VisualStudio.

The libiconv can be compiled following this complete tutorial, also given as link in the first link.


The version 1.14 of libxml2 has now a VS2010 solution. Now it is very simple to do this!

Otherwise, you can follow the readme and Marlow's tutorial to do the same job with other windows specific compilers.


I want to write down here some details about the VS2010 solution included with libxml2 v1.14, to help anyone interested. It is pretty badly done; for example, the Release configuration is not properly done at all, you have to do it. If you want to use it, I give you two advices:

  1. Delete first the project iconv if the path is not correct. Then add your project file; you will have still a warning at compilation, due to a reference kept on the old file. To suppress this warning, edit the .vcxproj with a text editor, change the ProjectReference Include path of the last ItemGroup with the correct path, AND also the Project item of this node (replace it with the ProjectGuid of the iconv vcxproj).

  2. Link with Ws2_32.lib any application using the static library libxml2.lib.

These are some errors I've been thru, hope this will help anyone who wants to rebuilds libxml2 under VS.