Re: Libpq linked statically linked to OpenSSL/LibreSSL

From: Marco Bambini <marco(at)creolabs(dot)com>
To: ALBERTO CABELLO SÁNCHEZ <alberto(at)unex(dot)es>
Cc: "pgsql-interfaces(at)lists(dot)postgresql(dot)org" <pgsql-interfaces(at)lists(dot)postgresql(dot)org>
Subject: Re: Libpq linked statically linked to OpenSSL/LibreSSL
Date: 2022-12-05 16:47:07
Message-ID: 7B10A8B6-04E3-49F3-AB0D-413E8B0AC365@creolabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Thanks Alberto,

This is a very promising approach.

I tried to modify the Makefile in src/interfaces/libpq/Makefile and I replaced the occurrences of -lssl and -lcrypto with:
/root/rothsoft/libressl-3.6.1/ssl/.libs/libssl.a
/root/rothsoft/libressl-3.6.1/crypto/.libs/libcrypto.a

The compilation process is OK but when I tried to execute the test app I receive a link error:
Error loading DLL: /root/rothsoft/engines/postgreSQL/Linux/postgresql/libpq.so: undefined symbol: GENERAL_NAME_free

GENERAL_NAME_free usually means that libcrypto is missed.

Any help would be really appreciated.

Please note that I also tried with:
-l:/root/rothsoft/libressl-3.6.1/ssl/.libs/libssl.a
-l:/root/rothsoft/libressl-3.6.1/crypto/.libs/libcrypto.a

Thanks,
Marco

> On 5 Dec 2022, at 14:10, ALBERTO CABELLO SÁNCHEZ <alberto(at)unex(dot)es> wrote:
>
>>> Hi all,
>>>
>>> After several attempts, I am asking for help with how to compile libpq with OpenSSL
>>> statically linked.
>>> I need to have libpq linked with LibreSSL, but if I could statically link OpenSSL, I think
>>> I could switch the TLS libraries at compile time.
>>
>> redo the step which creates libpq.so appending your libssl.a location
>> (mine is /usr/lib/x86_64-linux-gnu/libssl.a) at the end.
>
> Just wanted to correct: you also have to remove "-lssl". So I guess you can just
> substitute "-lssl" for libssl.a location in src/interfaces/libpq/Makefile (two occurrences)
> and build as usual.
>

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Marco Bambini 2022-12-06 10:05:49 Re: Libpq linked statically linked to OpenSSL/LibreSSL
Previous Message ALBERTO CABELLO SÁNCHEZ 2022-12-05 13:10:33 RE: Libpq linked statically linked to OpenSSL/LibreSSL