NetBSD Problem Report #60303

From www@netbsd.org  Sun May 31 19:37:53 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8ED191A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 31 May 2026 19:37:53 +0000 (UTC)
Message-Id: <20260531193752.75EFD1A923B@mollari.NetBSD.org>
Date: Sun, 31 May 2026 19:37:52 +0000 (UTC)
From: jun@soum.co.jp
Reply-To: jun@soum.co.jp
To: gnats-bugs@NetBSD.org
Subject: x11/qt6-qtbase: fix build failure on 32-bit powerpc
X-Send-Pr-Version: www-1.0
X-From4GNATS: "jun@soum.co.jp via gnats" <gnats-admin@NetBSD.org>

>Number:         60303
>Category:       pkg
>Synopsis:       x11/qt6-qtbase: fix build failure on 32-bit powerpc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 31 19:40:00 +0000 2026
>Originator:     Jun Ebihara
>Release:        pkgsrc current  May 28 2026
>Organization:
SOUM Corporation
>Environment:
NetBSD wiiu 11.99.5 NetBSD 11.99.5 (NINTENDO.MP) #0: Mon Mar  2 13:41:54 UTC 2026  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbppc/compile/NINTENDO.MP evbppc

>Description:
When building x11/qt6-qtbase on NetBSD/powerpc (32-bit), the build fails with a static assertion error in src/corelib/kernel/qtestsupport_core.cpp.

The error message is:

error: static assertion failed
static_assert(std::atomic<std::chrono::milliseconds>::is_always_lock_free);

This occurs because on 32-bit PowerPC, 64-bit atomic operations for std::chrono::milliseconds are not "always lock-free" in hardware. While libatomic provides the necessary support at runtime, the strict compile-time assertion in Qt6 prevents the build from completing.

To fix this, we need to:

1.  Link against devel/libatomic on PowerPC.
2.  Disable the problematic static_assert specifically for 32-bit PowerPC, relying on libatomic to handle the operations.

>How-To-Repeat:
Attempt to build x11/qt6-qtbase on a NetBSD/powerpc system (e.g., Wii U or older Mac hardware).

>Fix:
I have verified that the build failure on 32-bit PowerPC can be resolved by applying the following two modifications.

1. Modification to x11/qt6-qtbase/Makefile

Add a link to libatomic specifically for the powerpc architecture. This ensures that 64-bit atomic operations, which are not native to the hardware, can be handled by the library.

makefile
--- x11/qt6-qtbase/Makefile.orig
+++ x11/qt6-qtbase/Makefile
@@ -... @@
 .include "../../mk/bsd.prefs.mk"

+.if ${MACHINE_ARCH} == "powerpc"
+.include "../../devel/libatomic/buildlink3.mk"
+LDFLAGS+=	-latomic
+.endif


2. New patch for qtestsupport_core.cpp

Create a new patch file patches/patch-src_corelib_kernel_qtestsupport__core.cpp to bypass the static_assert that incorrectly assumes lock-free 64-bit atomics on all platforms. With libatomic linked, the code will function correctly despite not being "always lock-free" at compile-time.

$NetBSD$

On 32-bit PowerPC, std::atomic<std::chrono::milliseconds> is not always lock-free.
Disable the static_assert and rely on libatomic.

--- src/corelib/kernel/qtestsupport_core.cpp.orig	2026-05-31 00:00:00.000000000 +0000
+++ src/corelib/kernel/qtestsupport_core.cpp
@@ -10,7 +10,9 @@
 #include <QtCore/qtestsupport_core.h>
 #include <QtCore/qvariant.h>

+#if !defined(Q_PROCESSOR_POWER_32)
 static_assert(std::atomic<std::chrono::milliseconds>::is_always_lock_free);
+#endif

 QT_BEGIN_NAMESPACE

Verification Steps:

1.  Applied the changes above to x11/qt6-qtbase.
2.  Executed make makepatchsum to update the distinfo.
3.  Ran make on a NetBSD/powerpc system.
4.  Confirmed that the build now completes successfully without the previous static_assert error.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.