[stunnel-users] Help - Getting stunnel compiled on windows and using a patch

Cort, Tom Tom.Cort at state.vt.us
Wed Nov 12 21:29:48 CET 2008

Hello Reinier,

> So I hope you will be able to help me, or point me to a
> good howto on how to compile stunnel using windows and a
> patch from the patch-list

The INSTALL.W32 file in the source tarball says "native compilation on a Windows machine is possible, but not supported." The approach suggested in the file is to install a cross compiler on a Linux machine and build the stunnel binary there. A while ago I successfully compiled stunnel 4.24 on Linux after a lot of trial and error. I wrote down these instructions at the time, but I don't know if they're applicable to openssl-0.9.8i and stunnel-4.26. Hopefully I wrote down everything correctly. If you (or anyone else) discovers or knows of a better way to build an stunnel binary for Windows, please share it with the list and/or add it to the INSTALL.W32 file.

* Install mingw32

apt-get install mingw32

* Download and unpack openssl-0.9.8h

* Make sure the environment is setup properly.

export CC=i586-mingw32msvc-gcc
export CXX=i586-mingw32msvc-c++
export LD=i586-mingw32msvc-ld
export AR=i586-mingw32msvc-ar
export AS=i586-mingw32msvc-as
export NM=i586-mingw32msvc-nm
export STRIP=i586-mingw32msvc-strip
export RANLIB=i586-mingw32msvc-ranlib
export DLLTOOL=i586-mingw32msvc-dlltool
export OBJDUMP=i586-mingw32msvc-objdump
export RESCOMP=i586-mingw32msvc-windres

* Edit Configure, remove the following line

$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());

* Edit Configure, replace ":-mno-cygwin -shared:" with

:-mno-cygwin -Wl,--export-all -shared:

* Configure and make

perl Configure mingw shared
sed -i -e 's/nm/i586-mingw32msvc-nm/g' Makefile.shared
make CC=i586-mingw32msvc-gcc RANLIB=i586-mingw32msvc-ranlib

* Download and unpack stunnel-4.24

* Configure it

./configure --with-ssl=/path/to/openssl-0.9.8h

* Extracted openssl source code to /usr/src because the makefile adds "-I/usr/src/openssl-0.9.8h/include" to CFLAGS.

cd /usr/src && tar zvxf ~/openssl-0.9.8h.tar.gz

* Go back to stunnel-4.24/src

make stunnel.exe

Hope this helps,

More information about the stunnel-users mailing list