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

BUG #6486: configure - unable to cross-compile postgresql withopenssl using Fedora MinGW

From: tometzky(at)batory(dot)org(dot)pl
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6486: configure - unable to cross-compile postgresql withopenssl using Fedora MinGW
Date: 2012-02-23 18:51:39
Message-ID: E1S0dlT-0001ls-JY@wrigleys.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6486
Logged by:          Tomasz Ostrowski
Email address:      tometzky(at)batory(dot)org(dot)pl
PostgreSQL version: 9.1.2
Operating system:   Fedora Linux 16
Description:        

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=i686-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=i686-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=i686-pc-mingw32 && make
completed successfully and a working binary and libpq.dll using
libcrypto-10.dll and libssl-10.dll was created.

Regards
Tometzky
-- 
...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
 



Responses

pgsql-bugs by date

Next:From: Tomasz OstrowskiDate: 2012-02-23 18:59:12
Subject: Re: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW
Previous:From: Tom LaneDate: 2012-02-23 16:21:16
Subject: Re: BUG #6485: Primary index key not updated uniformly

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