Cross compiling libexiv2 for windows on linux

Added by Olivier Tilloy 45 days ago

Hi Andreas & all,

I'm hopefully close to releasing version 0.2 of my python binding to libexiv2, pyexiv2.
I'd like to test it (and have an official release) on windows, and for me the easiest solution is to cross compile it on linux using mingw32. I remember reading somewhere that there exist some scripts to automate that, are they available somewhere?
Instructions to retrieve the needed dependencies and cross compile libexiv2 would be very welcome.
Thanks in advance for your help!

Olivier


Replies

RE: Cross compiling libexiv2 for windows on linux - Added by Andreas Huggel 45 days ago

Hi Olivier,

I use the attached script to cross-compile the exiv2 windows executable that is available on exiv2.org on my Debian system.
The libraries and header files that I use here are also attached, although I recommend you build or otherwise get your own - I don't remember where I have these from.

Andreas

exiv2-buildwinexe.sh - Cross-compile Exiv2 executable for Windows (1.2 KB)

libs.tar.gz - Required Windows libraries and header files (821.6 KB)

RE: Cross compiling libexiv2 for windows on linux - Added by Olivier Tilloy 45 days ago

Thanks a lot Andreas, I'll experiment with your script and write about my findings (I'll probably document the full build process for pyexiv2 on windows anyway).

RE: Cross compiling libexiv2 for windows on linux - Added by Olivier Tilloy 3 days ago

I finally found the time to experiment with cross-compilation, and with the help of your script I found it pretty straightforward to cross-compile libexiv2 statically, which is what I want for pyexiv2.
Getting the other dependencies to compile (in particular boost_python) was much more of a hairy problem, but that's off topic here.

I wrote a very basic shell script that retrieves the dependencies and compiles them, here is how it looks, up to compilation of libexiv2:

#!/bin/sh

BASE=$HOME/dev/win32
mkdir -p $BASE
cd $BASE

PLATFORM=i586-mingw32msvc
COMPILER=$PLATFORM-g++
ARCHIVER=$PLATFORM-ar

# zlib (for exiv2)
wget http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php
unzip -d zlib zlib-*.zip

# iconv (for exiv2)
wget ftp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xzf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --enable-static --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=i586-linux --prefix=$BASE/libiconv
make
make install
cd ..

# expat (for exiv2)
wget http://sourceforge.net/projects/expat/files/expat/2.0.1/expat-2.0.1.tar.gz/download
tar xf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --disable-shared --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=i586-linux --prefix=$BASE/expat
make
make install
cd ..

# exiv2
wget http://exiv2.org/exiv2-0.19.tar.gz
tar xzf exiv2-0.19.tar.gz
cd exiv2-0.19
./configure --disable-shared --disable-visibility --target=$PLATFORM --host=$PLATFORM --build=i586-linux --disable-nls --with-zlib=$BASE/zlib --with-libiconv-prefix=$BASE/libiconv --with-expat=$BASE/expat --prefix=$BASE/exiv2
make
make install
cd ..

And voilĂ , the result is located in $HOME/dev/win32/exiv2/.