NetBSD Problem Report #58716
From www@netbsd.org Fri Oct 4 14:33:38 2024
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) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 8EEBC1A923B
for <gnats-bugs@gnats.NetBSD.org>; Fri, 4 Oct 2024 14:33:38 +0000 (UTC)
Message-Id: <20241004143337.5648C1A923D@mollari.NetBSD.org>
Date: Fri, 4 Oct 2024 14:33:37 +0000 (UTC)
From: brandon@burn.net
Reply-To: brandon@burn.net
To: gnats-bugs@NetBSD.org
Subject: libatomic fails to build on sparc
X-Send-Pr-Version: www-1.0
>Number: 58716
>Category: pkg
>Synopsis: libatomic fails to build on sparc
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 04 14:35:01 +0000 2024
>Closed-Date: Mon Feb 02 03:46:56 +0000 2026
>Last-Modified: Mon Feb 02 03:46:56 +0000 2026
>Originator: Brandon Applegate
>Release: 10.0_2024Q3
>Organization:
>Environment:
NetBSD qemu-10.internal.burn.net 10.0 NetBSD 10.0 (GENERIC.MP) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/sparc/compile/GENERIC.MP sparc
>Description:
Configure dies with word size determination:
checking for the word size... configure: error: Could not determine word size.
*** Error code 1
>How-To-Repeat:
make install
>Fix:
>Release-Note:
>Audit-Trail:
From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/58716: libatomic fails to build on sparc
Date: Sat, 28 Dec 2024 11:39:50 -0600 (CST)
As of pkgsrc-2024Q4 and netbsd/sparc 10.1, this problem persists.
$ uname -a
NetBSD jean.technoskunk.fur 10.1 NetBSD 10.1 (JEAN) #69: Mon Dec 16 21:35:25 CST 2024 sysop@plex760.technoskunk.fur:/r0/build/netbsd-10/obj/sparc/sys/arch/sparc/compile/JEAN sparc
Searching through ${WRKOBJDIR}/devel/libatomic/work/build/config.log
shows:
[...]
configure:14867: checking for the word size
configure:14872: gcc -o conftest -O2 -I/usr/include -fno-sync-libcalls -mcpu=v9 -I/usr/include -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib conftest.c >&5
configure:14872: $? = 0
configure:14872: ./conftest
[1] Illegal instruction (core dumped) ./conftest${ac_exeext}
configure:14872: $? = 132
configure: program exited with status 132
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Atomic Library"
| #define PACKAGE_TARNAME "libatomic"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU Atomic Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libatomic/"
| #define PACKAGE "libatomic"
| #define VERSION "1.0"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define IFUNC_RESOLVER_ARGS void
| #define STDC_HEADERS 1
| #define STRING_WITH_STRINGS 1
| #define HAVE_FENV_H 1
| #define HAVE_INT1 1
| #define HAVE_INT2 1
| #define HAVE_INT4 1
| #define HAVE_INT8 1
| #define HAVE_INT16 0
| #define HAVE_ATOMIC_LDST_1 1
| #define HAVE_ATOMIC_LDST_2 1
| #define HAVE_ATOMIC_LDST_4 1
| #define HAVE_ATOMIC_LDST_8 1
| #define HAVE_ATOMIC_LDST_16 0
| #define HAVE_ATOMIC_TAS_1 1
| #define HAVE_ATOMIC_TAS_2 1
| #define HAVE_ATOMIC_TAS_4 1
| #define HAVE_ATOMIC_TAS_8 1
| #define HAVE_ATOMIC_TAS_16 0
| #define HAVE_ATOMIC_EXCHANGE_1 1
| #define HAVE_ATOMIC_EXCHANGE_2 1
| #define HAVE_ATOMIC_EXCHANGE_4 1
| #define HAVE_ATOMIC_EXCHANGE_8 0
| #define HAVE_ATOMIC_EXCHANGE_16 0
| #define HAVE_ATOMIC_CAS_1 1
| #define HAVE_ATOMIC_CAS_2 1
| #define HAVE_ATOMIC_CAS_4 1
| #define HAVE_ATOMIC_CAS_8 0
| #define HAVE_ATOMIC_CAS_16 0
| #define HAVE_ATOMIC_FETCH_ADD_1 1
| #define HAVE_ATOMIC_FETCH_ADD_2 1
| #define HAVE_ATOMIC_FETCH_ADD_4 1
| #define HAVE_ATOMIC_FETCH_ADD_8 0
| #define HAVE_ATOMIC_FETCH_ADD_16 0
| #define HAVE_ATOMIC_FETCH_OP_1 1
| #define HAVE_ATOMIC_FETCH_OP_2 1
| #define HAVE_ATOMIC_FETCH_OP_4 1
| #define HAVE_ATOMIC_FETCH_OP_8 0
| #define HAVE_ATOMIC_FETCH_OP_16 0
| #define WORDS_BIGENDIAN 1
| /* end confdefs.h. */
| typedef int word __attribute__((mode(word)));
| static long int longval () { return sizeof(word); }
| static unsigned long int ulongval () { return sizeof(word); }
| #include <stdio.h>
| #include <stdlib.h>
| int
| main ()
| {
|
| FILE *f = fopen ("conftest.val", "w");
| if (! f)
| return 1;
| if ((sizeof(word)) < 0)
| {
| long int i = longval ();
| if (i != (sizeof(word)))
| return 1;
| fprintf (f, "%ld", i);
| }
| else
| {
| unsigned long int i = ulongval ();
| if (i != (sizeof(word)))
| return 1;
| fprintf (f, "%lu", i);
| }
| /* Do not output a trailing newline, as this causes \r\n confusion
| on some platforms. */
| return ferror (f) || fclose (f) != 0;
|
| ;
| return 0;
| }
configure:14875: error: Could not determine word size.
It it telling that for some reason, the test program is being
compiled with "-mcpu=v9". That is likely the source of the failure.
It is not yet clear why this directive has been specified. The tests
prior to the word-size check all passed/failed based on other criteria,
but the word-size check produced an illegal instruction fault which
was apparently not anticipated by the "configure" script.
Also noted in the "config.log" "OUTPUT VARIABLES" section was:
CFLAGS='-O2 -I/usr/include -fno-sync-libcalls -mcpu=v9'
and
XCFLAGS=' -mcpu=v9'
Perhaps there should be a "SUBST" block conditioned on MACHINE_ARCH
being "sparc" to remove the "-mcpu=v9" directives?
--
|/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
|\ / jdbaker[snail]consolidated[flyspeck]net OpenBSD FreeBSD
| X No HTML/proprietary data in email. BSD just sits there and works!
|/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/58716: libatomic fails to build on sparc
Date: Sat, 28 Dec 2024 17:01:26 -0600 (CST)
With the patch posted previously, the build completes. My build is
proceeding with the other dependencies leading up to the package that
required libatomic in the first place. Then we'll see if it works.
The build host is a SPARCstation5-110. When it was attempting to build
with "-mcpu=v9", a lot of atomic-related tests passed. Now that there
is no "-mcpu=foo" directive at all most of these previously-passing
tests now fail. The GCC manual page indicates that the default
code-generation target (w/o any "-mcpu=foo") is SPARCv7. This would
seem appropriate for my use case as I have some SUN4C machines (IPX,
SS1+, SS2) that I believe are generally SPARCv7 CPUs.
--
|/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
|\ / jdbaker[snail]consolidated[flyspeck]net OpenBSD FreeBSD
| X No HTML/proprietary data in email. BSD just sits there and works!
|/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/58716: libatomic fails to build on sparc
Date: Sat, 28 Dec 2024 16:25:57 -0600 (CST)
The following patch allows configuration to complete (extra leading "+"
to make sure leading whitespace isn't eaten):
+--- libatomic/configure.tgt.orig 2023-07-27 03:13:07.000000000 -0500
++++ libatomic/configure.tgt 2024-12-28 16:12:52.769758671 -0600
+@@ -68,7 +68,7 @@ case "${target_cpu}" in
+ ;;
+ *)
+ if test -z "$with_cpu"; then
+- XCFLAGS="${XCFLAGS} -mcpu=v9"
++ : #XCFLAGS="${XCFLAGS} -mcpu=v9"
+ fi
+ esac
+ ARCH=sparc
Will commence with build to see if things work.
--
|/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
|\ / jdbaker[snail]consolidated[flyspeck]net OpenBSD FreeBSD
| X No HTML/proprietary data in email. BSD just sits there and works!
|/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
From: Brandon Applegate <brandon@burn.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/58716
Date: Wed, 1 Oct 2025 18:44:22 -0400 (EDT)
This still happens in 2025Q3.
I'm not well acquainted with what the process should be here - could the
NetBSD folks insert a patch into pkgsrc to fix this OR does this need to
be taken upstream (GNU/gcc folks I assume in this case ?)
BTW the small patch/change from John does work.
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Thu, 02 Oct 2025 06:09:59 +0000
State-Changed-Why:
I've just committed John's fix, thanks for the bug report & ping!
From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/58716 CVS commit: pkgsrc/devel/libatomic
Date: Thu, 2 Oct 2025 06:09:36 +0000
Module Name: pkgsrc
Committed By: wiz
Date: Thu Oct 2 06:09:36 UTC 2025
Modified Files:
pkgsrc/devel/libatomic: distinfo
Added Files:
pkgsrc/devel/libatomic/patches: patch-libatomic_configure.tgt
Log Message:
libatomic: fix build on sparc
Older models don't support -mcpu=v9.
From John D. Baker in PR 58716.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 pkgsrc/devel/libatomic/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/devel/libatomic/patches/patch-libatomic_configure.tgt
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: closed->pending-pullups
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Sun, 19 Oct 2025 10:23:02 +0000
State-Changed-Why:
I asked for the change to be pulled up to 2025Q3.
From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/58716 CVS commit: [pkgsrc-2025Q3] pkgsrc/devel/libatomic
Date: Tue, 21 Oct 2025 01:52:26 +0000
Module Name: pkgsrc
Committed By: maya
Date: Tue Oct 21 01:52:26 UTC 2025
Modified Files:
pkgsrc/devel/libatomic [pkgsrc-2025Q3]: distinfo
Added Files:
pkgsrc/devel/libatomic/patches [pkgsrc-2025Q3]:
patch-libatomic_configure.tgt
Log Message:
Pullup ticket #7014 - requested by bsiegert
devel/libatomic: Build fix
Revisions pulled up:
- devel/libatomic/distinfo 1.12
- devel/libatomic/patches/patch-libatomic_configure.tgt 1.1
---
Module Name: pkgsrc
Committed By: wiz
Date: Thu Oct 2 06:09:36 UTC 2025
Modified Files:
pkgsrc/devel/libatomic: distinfo
Added Files:
pkgsrc/devel/libatomic/patches: patch-libatomic_configure.tgt
Log Message:
libatomic: fix build on sparc
Older models don't support -mcpu=v9.
From John D. Baker in PR 58716.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.16.1 pkgsrc/devel/libatomic/distinfo
cvs rdiff -u -r0 -r1.1.2.2 \
pkgsrc/devel/libatomic/patches/patch-libatomic_configure.tgt
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 02 Feb 2026 03:46:56 +0000
State-Changed-Why:
pulled up to all applicable branches, it seems
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.