pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/60371: multimedia/x265 fails on certain 32 bit archs
The following reply was made to PR pkg/60371; it has been noted by GNATS.
From: Havard Eidnes <he%NetBSD.org@localhost>
To: gnats-bugs%netbsd.org@localhost, gnats-admin%NetBSD.org@localhost
Cc: pkg-manager%netbsd.org@localhost, pkgsrc-bugs%netbsd.org@localhost
Subject: Re: pkg/60371: multimedia/x265 fails on certain 32 bit archs
Date: Fri, 26 Jun 2026 23:27:00 +0200 (CEST)
>>Fix:
>
> Perhaps add -DNO_ATOMICS=1 to CMAKE_CONFIGURE_ARGS for archs
> without 64 bit atomics.
...or convert from using the apparently old, will eventually be
deprecated __sync* operations to the newer __atomic* operations,
and use -latomic via mk/atomic64.mk?
To that end:
--- Makefile.orig 2026-06-26 23:20:44.960871122 +0200
+++ Makefile 2026-06-26 21:24:17.343747150 +0200
@@ -39,4 +39,5 @@
.endif
.include "../../devel/cmake/build.mk"
+.include "../../mk/atomic64.mk"
.include "../../mk/bsd.pkg.mk"
--- /dev/null 2026-06-26 21:27:49.120260554 +0200
+++ patches/patch-common_threading.h 2026-06-26 21:26:48.565959694 +0200
@@ -0,0 +1,23 @@
+$NetBSD$
+
+Try with a variant where we replace __sync* with __atomic*.
+
+--- common/threading.h.orig 2026-04-19 08:29:17.000000000 +0200
++++ common/threading.h 2026-06-26 20:37:17.150566275 +0200
+@@ -81,11 +81,11 @@
+ #define BSF(id, x) (id) = ((unsigned long)__builtin_ctz(x))
+ #define BSR64(id, x) (id) = ((unsigned long)__builtin_clzll(x) ^ 63)
+ #define BSF64(id, x) (id) = ((unsigned long)__builtin_ctzll(x))
+-#define ATOMIC_OR(ptr, mask) __sync_fetch_and_or(ptr, mask)
+-#define ATOMIC_AND(ptr, mask) __sync_fetch_and_and(ptr, mask)
+-#define ATOMIC_INC(ptr) __sync_add_and_fetch((volatile int32_t*)ptr, 1)
+-#define ATOMIC_DEC(ptr) __sync_add_and_fetch((volatile int32_t*)ptr, -1)
+-#define ATOMIC_ADD(ptr, val) __sync_fetch_and_add((volatile __typeof__(*(ptr))*)ptr, (__typeof__(*(ptr) + 0))(val))
++#define ATOMIC_OR(ptr, mask) __atomic_fetch_or(ptr, mask, __ATOMIC_SEQ_CST)
++#define ATOMIC_AND(ptr, mask) __atomic_fetch_and(ptr, mask, __ATOMIC_SEQ_CST)
++#define ATOMIC_INC(ptr) __atomic_add_fetch((volatile int32_t*)ptr, 1, __ATOMIC_SEQ_CST)
++#define ATOMIC_DEC(ptr) __atomic_add_fetch((volatile int32_t*)ptr, -1, __ATOMIC_SEQ_CST)
++#define ATOMIC_ADD(ptr, val) __atomic_fetch_add((volatile __typeof__(*(ptr))*)ptr, (__typeof__(*(ptr) + 0))(val), __ATOMIC_SEQ_CST)
+ #define GIVE_UP_TIME() usleep(0)
+
+ #elif defined(_MSC_VER) /* Windows atomic intrinsics */
and then re-generate the patch checksums with "make mps".
At least in my case that produced a successful build of this
package. Note that I've not tested the result out over that.
References:
https://llvm.org/docs/Atomics.html
and
https://gcc.gnu.org/wiki/Atomic/GCCMM
Regards,
- Havard
Home |
Main Index |
Thread Index |
Old Index