Обсуждение: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW

Поиск
Список
Период
Сортировка

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

От
tometzky@batory.org.pl
Дата:
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

Re: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW

От
Tomasz Ostrowski
Дата:
On 2012-02-23 19:51, tometzky@batory.org.pl wrote:

> I've attached a proposed patch for configure.in

The bug reporting form has word-wrapped my patch - I'm attaching a
correct version.

> 4. Run using "System Tools\Terminal":
>     su -c 'yum -y install mingw32-gcc mingw32-openssl gcc'

Sorry - make this:
    su -c 'yum -y install mingw32-gcc mingw32-openssl'
"gcc" isn't needed - much less to download.

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

Вложения

Re: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW

От
Tom Lane
Дата:
Tomasz Ostrowski <tometzky@batory.org.pl> writes:
> On 2012-02-23 19:51, tometzky@batory.org.pl wrote:
>> I've attached a proposed patch for configure.in

> The bug reporting form has word-wrapped my patch - I'm attaching a
> correct version.

Hmmm ... I'd be happier with this patch if it reversed the order of the
library probes (ie, try the nonstandard names first), as then it would
obviously not break any configurations that worked before.  Would that
be OK from your point of view, or not?

Also, the syntax looks wrong --- shouldn't the new calls be
AC_SEARCH_LIBS?

            regards, tom lane

Re: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW

От
Tomasz Ostrowski
Дата:
On 2012-02-23 20:28, Tom Lane wrote:

> Hmmm ... I'd be happier with this patch if it reversed the order of the
> library probes (ie, try the nonstandard names first), as then it would
> obviously not break any configurations that worked before.  Would that
> be OK from your point of view, or not?

It will be OK I guess.

> Also, the syntax looks wrong --- shouldn't the new calls be
> AC_SEARCH_LIBS?

Of course - my bad. I had to recreate a patch because I needed to return
back this autoconf version check and haven't retested it. I'm attaching
corrected and this time tested version. Sorry.

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

Вложения

Re: BUG #6486: configure - unable to cross-compile postgresql with openssl using Fedora MinGW

От
Tom Lane
Дата:
Tomasz Ostrowski <tometzky@batory.org.pl> writes:
>> Also, the syntax looks wrong --- shouldn't the new calls be
>> AC_SEARCH_LIBS?

> Of course - my bad. I had to recreate a patch because I needed to return
> back this autoconf version check and haven't retested it. I'm attaching
> corrected and this time tested version. Sorry.

OK, applied to HEAD and 9.1, will be in next week's 9.1.3 release
(you just made it under the wire for that ...)

            regards, tom lane