BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW - Mailing list pgsql-bugs

From tometzky@batory.org.pl
Subject BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW
Date
Msg-id E1S0dlT-0001ls-JY@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6486
Logged by:          Tomasz Ostrowski
Email address:      tometzky@batory.org.pl
PostgreSQL version: 9.1.2
Operating system:   Fedora Linux 16
Description:=20=20=20=20=20=20=20=20

Fedora MinGW is a project which allows for easy cross-compiling of Windows
binaries and libraries on Fedora Linux - much easier than with native MinGW
on Windows - just use "./configure --host=3Di686-pc-mingw32 && make" and
you're done. I'm using it to easily compile "libpq" and "libpqxx" for a C++
project.

I can compile PostgreSQL just fine using this but without OpenSSL support.
When I try to compile with OpenSSL on Windows Postgres expects to link with
libeay32.dll and libssleay32.dll, which aren't there, but ignores that there
are dll's for standard "crypto" and "ssl" libraries available.

To reproduce:

1. Download Fedora LiveCD iso from http://fedoraproject.org/

2. Run it in a virtual machine - for example:
    qemu-kvm -m 2048 -cdrom Fedora-16-i686-Live-Desktop.iso
You can also burn it to a CD-R or install it to a USB Thumb-drive using
"livecd-iso-to-disk" script included in this image, and start a physical
computer with it, but a virtual machine would be easier and faster.

3. Download postgresql-9.1.2.tar.bz2 to /tmp/

4. Run using "System Tools\Terminal":
    su -c 'yum -y install mingw32-gcc mingw32-openssl gcc'
    cd /tmp/
    tar xf postgresql-9.1.2.tar.bz2
    cd postgresql-9.1.2
    ./configure --with-openssl --host=3Di686-pc-mingw32

Result:
    (...)
    checking for CRYPTO_new_ex_data in -leay32... no
    configure: error: library 'eay32' is required for OpenSSL

I've attached a proposed patch for configure.in - it uses AC_SEARCH_LIBS
instead of AC_CHECK_LIB on Windows. With this patch and after autoreconf (I
needed also to remove "autoconf 2.63 is required" check from configure.in):
    ./configure --with-openssl --host=3Di686-pc-mingw32 && make
completed successfully and a working binary and libpq.dll using
libcrypto-10.dll and libssl-10.dll was created.

Regards
Tometzky
--=20
...although Eating Honey was a very good thing to do, there was a
moment just before you began to eat it which was better than when you
were...
                                                      Winnie the Pooh

diff -urNP postgresql-9.1.2.orig/configure.in postgresql-9.1.2/configure.in
--- postgresql-9.1.2.orig/configure.in    2011-12-01 22:47:20.000000000 +0100
+++ postgresql-9.1.2/configure.in    2012-02-23 19:24:43.708343882 +0100
@@ -945,8 +945,8 @@
      AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library
'crypto' is required for OpenSSL])])
      AC_CHECK_LIB(ssl,    SSL_library_init, [], [AC_MSG_ERROR([library
'ssl' is required for OpenSSL])])
   else
-     AC_CHECK_LIB(eay32, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library
'eay32' is required for OpenSSL])])
-     AC_CHECK_LIB(ssleay32,    SSL_library_init, [], [AC_MSG_ERROR([library
'ssleay32' is required for OpenSSL])])
+     AC_CHECK_LIB(CRYPTO_new_ex_data, crypto eay32, [],
[AC_MSG_ERROR([library 'crypto' or 'eay32' is required for OpenSSL])])
+     AC_CHECK_LIB(SSL_library_init, ssl ssleay32, [],
[AC_MSG_ERROR([library 'ssl' or 'ssleay32' is required for OpenSSL])])
   fi
 fi
=20

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #6485: Primary index key not updated uniformly
Next
From: Tomasz Ostrowski
Date:
Subject: Re: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW