pg.ddx.io  pgsql-ports@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: pgsql-ports@postgresql.org
Subject: mingw cross-compiling libpq.dll+ssl on Debian
Date: Fri, 10 Nov 2006 00:18:15 +0100
Message-ID: <4553B737.5050509@klaster.net> (raw)

Hello

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:

#!/bin/sh
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) 
$(DLLTOOL_LIBFLAGS) $(OBJS) $(SHLIB_LINK)
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= 
and MAKEDEPPROG=).

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



view thread (5+ messages)  latest in thread

Message-ID: <4553B737.5050509@klaster.net>
Permalink:  ../4553B737.5050509@klaster.net/
Also on:    postgresql.org/message-id/4553B737.5050509@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-ports@postgresql.org
  Cc: jasiek@klaster.net
  Subject: Re: mingw cross-compiling libpq.dll+ssl on Debian
  In-Reply-To: <4553B737.5050509@klaster.net>
  References: <4553B737.5050509@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox