Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 318CE9FB213 for ; Thu, 9 Nov 2006 19:37:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 55867-06 for ; Thu, 9 Nov 2006 19:37:54 -0400 (AST) X-Greylist: delayed 00:19:25.08775 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 9A1179FB2C0 for ; Thu, 9 Nov 2006 19:37:52 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from bt2.jordan.pl (unknown [62.121.132.242]) by svr4.postgresql.org (Postfix) with ESMTP id C83B75AF8BA for ; Thu, 9 Nov 2006 23:18:25 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by bt2.jordan.pl (Postfix) with ESMTP id D18F619C004 for ; Fri, 10 Nov 2006 00:18:34 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bt.jordan.pl Received: from bt2.jordan.pl ([127.0.0.1]) by localhost (bt2.jordan.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9BZ-1nm+gy+R for ; Fri, 10 Nov 2006 00:18:30 +0100 (CET) Received: from [192.168.24.4] (aczr120.neoplus.adsl.tpnet.pl [83.11.227.120]) by bt2.jordan.pl (Postfix) with ESMTP id B81EA19C002 for ; Fri, 10 Nov 2006 00:18:29 +0100 (CET) Message-ID: <4553B737.5050509@klaster.net> Date: Fri, 10 Nov 2006 00:18:15 +0100 From: Tomasz Myrta Organization: KLASTER User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: pgsql-ports@postgresql.org Subject: mingw cross-compiling libpq.dll+ssl on Debian Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.616 tagged_above=0 required=5 tests=BAYES_40, FORGED_RCVD_HELO, SARE_SPEC_LEO_DOLLARSa X-Spam-Level: * X-Archive-Number: 200611/1 X-Sequence-Number: 2483 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