HOWTO Compile Box Backup from source under Windows MingW/Cygwin

This article explain step by step how to compile Box Backup from source as a native Windows binary under MingW/Cygwin.

Install Cygwin

Install Cygwin by downloading the installer from (2.864 as of February 2015) and select the following packages (and the automatic dependencies that get added once you select the packages):

  • Archive/unzip
  • Devel/autoconf
  • Devel/automake
  • Devel/mingw64-x86_64-gcc-core
  • Devel/mingw64-x86_64-gcc-g++
  • Devel/gdb
  • Devel/gettext-devel
  • Devel/libtool
  • Devel/make
  • Devel/pkg-config
  • Devel/subversion
  • Lib/libxml2
  • Lib/libxslt
  • Mingw/mingw-zlib-devel
  • Perl/Perl
  • Web/wget

Alternatively, you could install all packages from the command line. Adjust this line to use your preferred mirror (instead of Uni Bochum), install location (c:\cygwin64) and temporary installation directory (c:\install\cygwin64):
setup-x86_64.exe -R c:\cygwin64 -s -l c:\install\cygwin64 -P unzip,autoconf,automake,mingw-gcc-core,mingw64-x86_64-gcc-g++,mingw64-x86_64-gcc-core,gdb,gettext-devel,libtool,make,pkg-config,subversion,libxml2,libxslt,mingw-zlib-devel,Perl,vim,wget

Optionally, you can add the following options (quiet, no shortcuts for start menu or desktop) after "setup.exe" above. See for a full reference:
-q -n

Once you installed cygwin, you can make use of apt-cyg (inspired by Debian's apt-get) to install packages from the command line. Launch a Cygwin BASH shell, and then install the latest SVN version of the apt-cyg script like this:

svn --force export /bin/
chmod +x /bin/apt-cyg

Following that, you can use the following command to install additional packages from within the Cygwin BASH shell, in this case the calculator bc:

apt-cyg install bc


The Mingw/mingw-zlib-devel package installed in step one eliminates the need to self-compile: some work saved!


Version 1.0.2 of OpenSSL compiles perfectly under MingW. We compile our standalone versions with the following steps:
cd /usr/local/src
tar xzvf openssl-1.0.2.tar.gz
cd openssl-1.0.2
CROSS_COMPILE="x86_64-w64-mingw32-" ./Configure mingw64 no-asm shared --prefix=/usr/i686-pc-mingw32
make && make install_sw


The existing Cygwin package of PCRE introduces a GPL requirement because of its cygwin1.dll dependency, as per the discussion with Chris on mailing list. We therefore want to compile our own standalone version with the following steps:
cd /usr/src
tar xvzf pcre-8.36.tar.gz
cd pcre-8.36
export CFLAGS="-mno-cygwin" && export CXXFLAGS="-mno-cygwin"
./configure --prefix=/usr/i686-pc-mingw32 --enable-utf --enable-unicode-properties \
--disable-shared --enable-static
make && make install

Compile and install Readline

Readline enables editing and completion of commands in bbackupquery. It is optional, but it makes bbackupquery easier to use. However, please do not enable readline if you intend to distribute the resulting Box Backup binaries, as this would be a violation of the GPL license of readline.
cd /usr/src
tar xzvf PDCurses-3.4.tar.gz
cd PDCurses-3.4/win32
make -f gccwin32.mak CC="gcc -mno-cygwin" LINK="gcc -mno-cygwin"
cp pdcurses.a /usr/i686-pc-mingw32/lib/libpdcurses.a

cd /usr/src
tar xzvf readline-6.2.tar.gz
cd readline-6.2
./configure --prefix=/usr/i686-pc-mingw32 \
CFLAGS="-mno-cygwin" \
CPPFLAGS="-mno-cygwin" \
LDFLAGS="-mno-cygwin" \
LIBS="-lpdcurses" \
--with-curses --disable-shared

make install

Compile Box Backup

You can choose to use the bleeding edge version of Box Backup directly from SVN with the following steps:

cd /usr/src
svn co boxbackup
cd boxbackup

or use the more stable offical releases that might lack some new features:

cd /usr/src
tar xvzf boxbackup-0.11.1.tgz
cd boxbackup-0.11.1.tgz

Now configure and build the client, optionally with [--enable-gnu-readline]:

./infrastructure/mingw/ [--enable-gnu-readline]
make build-backup-client

The last command compiles the Box Backup client for Windows. You will find the resulting binaries in the parcels sub-directory inside a folder called something like boxbackup-trunk_3116-backup-client-mingw32: the actual SVN revision (3116 in this case) might vary!

Since the server does not work under Win32 anyway, we save ourselves the time by not compiling it. You can type make above (instead of make build-backup-client) if you want to compile both client and server components.