Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Aug 2021 07:08:37 +0200
From:      Jan Beich <jbeich@FreeBSD.org>
To:        Bernard Spil <brnrd@freebsd.org>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: OpenSSL 3.0.0 on i386 failing to build
Message-ID:  <lf5l-oip6-wny@FreeBSD.org>
In-Reply-To: <def255f66dc4d77ccc1936fbc65ba123@freebsd.org> (Bernard Spil's message of "Thu, 29 Jul 2021 23:05:03 %2B0200")
References:  <def255f66dc4d77ccc1936fbc65ba123@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain

Bernard Spil <brnrd@freebsd.org> writes:

> Hi all,
>
> The OpenSSL 3.0.0 port (currently beta2) is failing on i386 due to
> missing atomic on i386
>
>> ld: error: undefined symbol: __atomic_is_lock_free
>
> Poudriere logs on vanilla FreeBSD
> https://brnrd.eu/poudriere/data/114i386-git/2021-07-29_17h04m18s/logs/errors/openssl-devel-3.0.0.b2.log
> https://brnrd.eu/poudriere/data/122i386-git/2021-07-29_17h04m18s/logs/errors/openssl-devel-3.0.0.b2.log

Did you try on 14.0-CURRENT? It should build fine without patches.

> This is apparently the last Release Candidate for OpenSSL 3.0.0. Would
> appreciate anyone to help fix this, preferably without requiring GCC.

Try the fallback a la <stdatomic.h> (example attached) or exclude atomic
calls on i386.


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment; filename=naive.diff
Content-Description: patch against the port (apply via "git am")

>From 232d20bde7bb902d60869fb732fec7ad1f211579 Mon Sep 17 00:00:00 2001
From: Jan Beich <jbeich@FreeBSD.org>
Date: Sun, 1 Aug 2021 04:22:08 +0000
Subject: [PATCH] security/openssl-devel: unbreak on i386 via atomic stub

Approved by:	?
---
 security/openssl-devel/Makefile               |  2 --
 .../files/patch-crypto_threads__pthread.c     | 20 +++++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 security/openssl-devel/files/patch-crypto_threads__pthread.c

diff --git a/security/openssl-devel/Makefile b/security/openssl-devel/Makefile
index 9f18800fa823..5f18559936af 100644
--- a/security/openssl-devel/Makefile
+++ b/security/openssl-devel/Makefile
@@ -17,8 +17,6 @@ CONFLICTS_INSTALL=	libressl-[0-9]* \
 			libressl-devel-[0-9]* \
 			openssl-[0-9]*
 
-BROKEN_i386=	ld: error: undefined symbol: __atomic_is_lock_free
-
 HAS_CONFIGURE=	yes
 CONFIGURE_SCRIPT=	config
 CONFIGURE_ENV=	PERL="${PERL}"
diff --git a/security/openssl-devel/files/patch-crypto_threads__pthread.c b/security/openssl-devel/files/patch-crypto_threads__pthread.c
new file mode 100644
index 000000000000..fbc67e3e8393
--- /dev/null
+++ b/security/openssl-devel/files/patch-crypto_threads__pthread.c
@@ -0,0 +1,20 @@
+Drop after FreeBSD 13.0/12.2 EOL around 2022-05-30
+
+ld: error: undefined symbol: __atomic_is_lock_free
+>>> referenced by threads_pthread.c
+>>>               libfips-lib-threads_pthread.o:(CRYPTO_atomic_or) in archive providers/libfips.a
+>>> referenced by threads_pthread.c
+>>>               libfips-lib-threads_pthread.o:(CRYPTO_atomic_load) in archive providers/libfips.a
+
+--- crypto/threads_pthread.c.orig	2021-07-29 14:50:29 UTC
++++ crypto/threads_pthread.c
+@@ -15,6 +15,9 @@
+ 
+ #if defined(__sun)
+ # include <atomic.h>
++#elif defined(__clang__) && defined(__i386__) && __clang_major__ < 12
++/* Until https://github.com/llvm/llvm-project/commit/00530dee5d12 */
++#define __atomic_is_lock_free(size, ptr) ((void)(ptr), size <= sizeof(void *))
+ #endif
+ 
+ #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS)

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?lf5l-oip6-wny>