Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2Qln-00010M-2n for pgsql-interfaces@arkaria.postgresql.org; Tue, 06 Dec 2022 05:45:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2Qll-0000MT-Nd for pgsql-interfaces@arkaria.postgresql.org; Tue, 06 Dec 2022 05:45:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2Qll-0000MK-Ga for pgsql-interfaces@lists.postgresql.org; Tue, 06 Dec 2022 05:45:29 +0000 Received: from mail2.g1.pair.com ([66.39.3.168]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2Qle-0004Ol-HZ for pgsql-interfaces@lists.postgresql.org; Tue, 06 Dec 2022 05:45:28 +0000 Received: from mail2.g1.pair.com (localhost [127.0.0.1]) by mail2.g1.pair.com (Postfix) with ESMTP id DE4C583243D; Tue, 6 Dec 2022 00:45:19 -0500 (EST) Received: from smtpclient.apple (host-95-233-97-166.retail.telecomitalia.it [95.233.97.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail2.g1.pair.com (Postfix) with ESMTPSA id 74453844B73; Tue, 6 Dec 2022 00:45:19 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Subject: Re: Libpq linked statically linked to OpenSSL/LibreSSL From: Marco Bambini In-Reply-To: Date: Mon, 5 Dec 2022 17:47:07 +0100 Cc: "pgsql-interfaces@lists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <7B10A8B6-04E3-49F3-AB0D-413E8B0AC365@creolabs.com> References: To: =?utf-8?Q?ALBERTO_CABELLO_S=C3=81NCHEZ?= X-Mailer: Apple Mail (2.3731.200.110.1.12) X-Scanned-By: mailmunge 3.10 on 66.39.3.168 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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=C3=81NCHEZ = wrote: >=20 >>> Hi all, >>>=20 >>> 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. >>=20 >> 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. >=20 > 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. >=20