BUG #15789: libpq compilation with OpenSSL 1.1.1b fails on Windows with Visual Studio 2017

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

BUG #15789: libpq compilation with OpenSSL 1.1.1b fails on Windows with Visual Studio 2017

apt.postgresql.org Repository Update
The following bug has been logged on the website:

Bug reference:      15789
Logged by:          Sergey Pashkov
Email address:      [hidden email]
PostgreSQL version: 11.2
Operating system:   Windows 10
Description:        

libssh2 and libpq are used in the same product.
It is necessary to use OpenSSL 1.1.1b as it includes EdDSA support required
for libssh2.

Here are parts of our build scripts.

1. Building OpenSSL:
perl Configure VC-WIN64A no-shared no-asm enable-ssl3 enable-ssl3-method
nmake

2. Building libpq:
XCOPY /s /i "%OPENSSL_SRCS%" "%OPENSSL_PATH%"
MKDIR "%OPENSSL_PATH%\lib"
COPY "%THIRD_LIBS%\libssl_64.lib" "%OPENSSL_PATH%\lib\ssleay32.lib"
COPY "%THIRD_LIBS%\libcrypto_64.lib" "%OPENSSL_PATH%\lib\libeay32.lib"

perl mkvcbuild.pl
COPY config_default.pl config.pl
sed -i "s/openssl   => undef/openssl   => \"%OPENSSL_PATH_ESC%\"/g"
config.pl
perl mkvcbuild.pl
msbuild pgsql.sln /t:interfaces\libpq /p:Configuration="Release" /m

The following errors are encountered:

       "C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj" (default
target) (6) ->
       (ClCompile target) ->
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1467):
error C2037: left
        of 'ptr' specifies undefined struct/union 'bio_st'
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1467):
error C2198: 'pqs
       ecure_raw_read': too few arguments for call
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1497):
error C2037: left
        of 'ptr' specifies undefined struct/union 'bio_st'
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1497):
error C2198: 'pqs
       ecure_raw_write': too few arguments for call
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1556):
error C2027: use
       of undefined type 'bio_method_st'
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1559):
error C2027: use
       of undefined type 'bio_method_st'
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1560):
error C2037: left
        of 'bread' specifies undefined struct/union 'bio_method_st'
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq
       .vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1561):
error C2037: left
        of 'bwrite' specifies undefined struct/union 'bio_method_st'
[C:\Users\User\AppData\Local\Temp\postgres_64\libp
       q.vcxproj]
       
c:\users\user\appdata\local\temp\postgres_64\src\interfaces\libpq\fe-secure-openssl.c(1587):
error C2037: left
        of 'ptr' specifies undefined struct/union 'bio_st'
[C:\Users\User\AppData\Local\Temp\postgres_64\libpq.vcxproj]

Headers of the recent OpenSSL versions don't include bio_st definition, as
it was in 1.0.2.

If I manually define the following macros in pg_config.h:

HAVE_BIO_GET_DATA
HAVE_BIO_METH_NEW

- compilation passes but SSL connection cannot be established anyway.

This question was raised in the following thread:
https://www.postgresql.org/message-id/flat/CAAw-Mseg9JYpp%3DA%3D51HR3rKiQtbvT0MWw%2BaYFwNeJEbdNr%3DCDA%40mail.gmail.com

No solution was proposed.

Thank you!