Skip site navigation (1) Skip section navigation (2)

mingw cross-compiling libpq.dll+ssl on Debian

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: pgsql-ports(at)postgresql(dot)org
Subject: mingw cross-compiling libpq.dll+ssl on Debian
Date: 2006-11-09 23:18:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-ports

I've tried to recompile libpq.dll with ssl support using mingw32 
cross-compiler on Debian. I would like to create single lightweight 
libpq-ssl.dll instead of almost 3MB 
libpq.dll+libeay32.dll+krb5_32.dll+libintl-2.dll+ssleay32.dll deployed 
recently with Postgresql Windows package. My Postgresql source version 
is 8.1.5. I have some success, but it's not enough.

1. Patching mingw32.
Windres is unknown application for Debian, so we need to create file 
/usr/bin/windres containing:

i586-mingw32msvc-windres -I  /usr/i586-mingw32msvc/include/ $1 $2 $3 $4 
$5 $6 $7

2. Creating makefile - without ssl support for now:
export CC=i586-mingw32msvc-gcc
export LD=i586-mingw32msvc-ld
export AR=i586-mingw32msvc-ar
export NM=i586-mingw32msvc-nm
export RANLIB=i586-mingw32msvc-ranlib
export DLLTOOL=i586-mingw32msvc-dlltool
export OBJDUMP=i586-mingw32msvc-objdump
export STRIP=i586-mingw32msvc-strip
export STRIPPROG=i586-mingw32msvc-strip
export AS=i586-mingw32msvc-as
export RC=i586-mingw32msvc-windres
./configure --host=i586-mingw32msvc --without-zlib \
--prefix /usr/i586-mingw32msvc --target=i586-mingw32msvc \
export PATH=/usr/i586-mingw32msvc/bin:$PATH

3. dllwrap gives an error:
/usr/i586-mingw32msvc/bin/ld: unrecognised emulation mode: elf_i386
Supported emulations: i386pe

I've read somewhere, that dll's can be linked through gcc. Replacing 
dll-tool with gcc in Makefile.shlib:
i586-mingw32msvc-gcc --strip-all -shared -DBUILDING_DLL -o $(shlib) 
solved the problem.

4. openssl is much easier to build:
./Configure mingw shared no-krb5
We have to replace "gcc" with "i586-mingw32msvc-gcc" in Makefile (CC= 

After applying these patches I'm able to get:
- libpq.dll without ssl support
- ssleay32-0.9.8.dll
- cryptoeay32-0.9.8.dll

Postgresql8.1.5 configure script --with-openssl option gives me an error:
configure: error: library 'eay32' is required for OpenSSL

- I have no idea how to make openssl dll's visible to it. I suppose, 
that cryptoeay32 is not expected library name.
- which openssl cyphers are really necessary to work with Postgresql ?
- when exactly is used libiconv.dll and libintl-2.dll - do I also need 
them ?
- how to link all of these libraries into single libpq.dll file ?

Best regards,
Tomasz Myrta


pgsql-ports by date

Next:From: Peter EisentrautDate: 2006-11-10 11:44:21
Subject: Re: mingw cross-compiling libpq.dll+ssl on Debian
Previous:From: Magnus HaganderDate: 2006-10-05 07:33:01
Subject: Re: PostgreSQL and Kerberos 5 on Solaris

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group