Project

General

Profile

Cross compiling libexiv2 for windows on linux

Added by Olivier Tilloy almost 12 years 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 (5)

RE: Cross compiling libexiv2 for windows on linux - Added by Andreas Huggel almost 12 years 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 (1.17 KB) exiv2-buildwinexe.sh Cross-compile Exiv2 executable for Windows
libs.tar.gz (822 KB) libs.tar.gz Required Windows libraries and header files

RE: Cross compiling libexiv2 for windows on linux - Added by Olivier Tilloy almost 12 years 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 over 11 years 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/.

RE: Cross compiling libexiv2 for windows on linux - Added by Benjamin H. almost 10 years ago

Have you an updated version of your script that reflects new versions of all that libs?
I would like to compile my patched version of exiv2 for win32 (maybe 64) using linux.
Or is there a new way for cross-compiling?

RE: Cross compiling libexiv2 for windows on linux - Added by Olivier Tilloy almost 10 years ago

The latest version of the script above can be found in pyexiv2's trunk branch: http://bazaar.launchpad.net/~osomon/pyexiv2/pyexiv2-0.3/view/head:/cross-compile.sh

It currently only works for win32 (64 bits support is not there yet). I hope this helps.

    (1-5/5)