NetBSD Problem Report #54660

From www@netbsd.org  Wed Oct 30 02:19:57 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 62ABF7A1EA
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 30 Oct 2019 02:19:57 +0000 (UTC)
Message-Id: <20191030021956.8E3977A1F8@mollari.NetBSD.org>
Date: Wed, 30 Oct 2019 02:19:56 +0000 (UTC)
From: jdbaker@consolidated.net
Reply-To: jdbaker@consolidated.net
To: gnats-bugs@NetBSD.org
Subject: undefined reference in libsupc++.a on netbsd-9/sparc
X-Send-Pr-Version: www-1.0

>Number:         54660
>Category:       port-sparc
>Synopsis:       undefined reference in libsupc++.a on netbsd-9/sparc
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    mrg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 30 02:20:00 +0000 2019
>Closed-Date:    Wed Apr 22 20:21:17 +0000 2020
>Last-Modified:  Fri Jul 22 21:30:02 +0000 2022
>Originator:     John D. Baker
>Release:        NetBSD/sparc-9.0_BETA, pkgsrc-2019Q3
>Organization:
>Environment:
NetBSD jean.technoskunk.fur 9.0_BETA NetBSD 9.0_BETA (JEAN) #26: Wed Oct 23 15:42:18 CDT 2019  sysop@plex760.technoskunk.fur:/r0/build/netbsd-9/obj/sparc/sys/arch/sparc/compile/JEAN sparc

>Description:
Building "sysutils/apcupsd" on NetBSD/sparc-9.0_BETA fails linking with:

[...]
  LD    src/apcupsd
ld: /usr/lib/libsupc++.a(eh_throw.o):(.text+0x78): undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'


I have an old binary package from the last time I built apcupsd on sparc.
It reports OS_VERSION of 8.99.26.  So whatever the gcc/g++ version and
libraries in use at that time, it worked fine.


>How-To-Repeat:
See above.
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-sparc-maintainer->mrg
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Wed, 30 Oct 2019 02:34:32 +0000
Responsible-Changed-Why:
i'll have a look


From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Sat, 9 Nov 2019 05:46:11 -0600 (CST)

 The same failure occurs with -current (9.99.17).

 -- 
 |/"\ 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: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    jdbaker@consolidated.net
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on netbsd-9/sparc
Date: Sat, 09 Nov 2019 23:52:57 +1100

 this is likely due to sparc lacking native CAS.  i have no idea
 if there is a simple or workable fix...

From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Tue, 12 Nov 2019 14:55:51 -0600 (CST)

 On Sat, 9 Nov 2019, matthew green wrote:

 >  this is likely due to sparc lacking native CAS.  i have no idea
 >  if there is a simple or workable fix...

 As there was no problem in the past (at least back to netbsd-6 through
 8.99.26), there must have been something that served that purpose.

 The claimed missing symbol is perhaps a GCC internal implementation
 substituted for missing hardware functionality?  In case it's relevant,
 the GCC in use for 8.99.26 appears to have been GCC-6.

 -- 
 |/"\ 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: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Mon, 18 Nov 2019 06:20:30 -0600 (CST)

 With sparc-current (9.99.17) switched to GCC 8, the same failure occurs.

 -- 
 |/"\ 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: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Fri, 17 Apr 2020 10:43:07 -0500 (CDT)

 I built HEAD from 20190209093400Z (8.99.34 just before sparc was switched
 to GCC7), showing:

   $ gcc -v
   [...]
   Target: sparc--netbsdelf
   [...]
   gcc version 6.5.0 (nb4 20181109) 

 In this state, "sysutils/apcupsd" built successfully on sparc.

 -- 
 |/"\ 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: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    jdbaker@consolidated.net
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on netbsd-9/sparc
Date: Sun, 19 Apr 2020 04:15:45 +1000

 this appears to be due to not using the right atomicity.h.

 we'll need some mknative updates i guess.  this problem also appears
 to be not sparc specific, but only triggers there...


 .mrg.

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    jdbaker@consolidated.net
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on netbsd-9/sparc
Date: Sun, 19 Apr 2020 05:00:25 +1000

 actually, atomicity.h is properly handled.  it's just that sparc
 wants it in libsupc++ and it's only in libstdc++.

 the hack below may help.

 John, i'll see about testing myself, but if you can try a test
 (you should only have to reinstall libsupc++.a) that would be
 great.  thanks.


 .mrg.


 Index: libsupc++/Makefile
 ===================================================================
 RCS file: /cvsroot/src/external/gpl3/gcc/lib/libsupc++/Makefile,v
 retrieving revision 1.12
 diff -p -u -r1.12 Makefile
 --- libsupc++/Makefile	19 Jan 2019 17:11:02 -0000	1.12
 +++ libsupc++/Makefile	18 Apr 2020 18:56:28 -0000
 @@ -25,6 +25,15 @@ SHLIB_MINOR=	0
  SRCS=		${LIBSUPCXXSRCS} xmalloc.c
  CXXFLAGS+=	${G_SECTION_FLAGS}

 +# XXX PR#54660
 +.if ${MACHINE} == "sparc"
 +SRCS+=		atomicity.cc
 +DIST=		${GCCDIST}
 +GLIBCXX_SRCDIR=	${DIST}/libstdc++-v3
 +BUILDSYMLINKS+=	\
 +	${GLIBCXX_SRCDIR}/${G_ATOMICITY_SRCDIR}/atomicity.h atomicity.cc
 +.endif
 +
  COPTS.cp-demangle.c = -Wno-stack-protector -Wno-unused-function

  .include "../Makefile.gthr"

From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Sat, 18 Apr 2020 20:18:50 -0500 (CDT)

 On Sat, 18 Apr 2020, matthew green wrote:

 >  actually, atomicity.h is properly handled.  it's just that sparc
 >  wants it in libsupc++ and it's only in libstdc++.
 >  
 >  the hack below may help.
 >  
 >  John, i'll see about testing myself, but if you can try a test
 >  (you should only have to reinstall libsupc++.a) that would be
 >  great.  thanks.

 I've applied the patch and rebuilt.  The two machines most likely to
 perform the test are currently occupied with long-running tasks.  As
 soon as one or the other is free, I'll be able to test.

 -- 
 |/"\ 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: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Sat, 18 Apr 2020 20:25:11 -0500 (CDT)

 On Sat, 18 Apr 2020, John D. Baker wrote:

 > I've applied the patch and rebuilt.  The two machines most likely to
 > perform the test are currently occupied with long-running tasks.  As
 > soon as one or the other is free, I'll be able to test.

 Actually, I've applied the patch to -current as well, so once I can get
 sparc-current rebuilt and updated, I have a machine already available on
 which to test.

 -- 
 |/"\ 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: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Sun, 19 Apr 2020 11:45:48 -0500 (CDT)

 On Sat, 18 Apr 2020, John D. Baker wrote:

 > Actually, I've applied the patch to -current as well, so once I can get
 > sparc-current rebuilt and updated, I have a machine already available on
 > which to test.

 My sparc-current system (9.99.56 from sources of 202004190030Z) with
 the patch applied successfully built "sysutils/apcupsd".

 One of the other systems is nearing the end of its long-running operation
 so I'll be able to test netbsd-9 with the patch soon.

 -- 
 |/"\ 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: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Mon, 20 Apr 2020 08:27:11 -0500 (CDT)

 On Sun, 19 Apr 2020, John D. Baker wrote:

 > One of the other systems is nearing the end of its long-running operation
 > so I'll be able to test netbsd-9 with the patch soon.

 I've now successfully completed the build of "sysutils/apcupsd" on
 netbsd-9/sparc.

 Unfortunately, base-system 'dhcpcd' seems to be broken after a release
 build and update with this hack in place.

 -- 
 |/"\ 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: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org, jdbaker@consolidated.net
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on netbsd-9/sparc
Date: Tue, 21 Apr 2020 07:04:44 +1000

 >  > One of the other systems is nearing the end of its long-running operation
 >  > so I'll be able to test netbsd-9 with the patch soon.
 >  
 >  I've now successfully completed the build of "sysutils/apcupsd" on
 >  netbsd-9/sparc.

 OK, i'll commit and request a pullup.  thanks for
 testing.

 >  Unfortunately, base-system 'dhcpcd' seems to be broken after a release
 >  build and update with this hack in place.

 i suspect this is due to dhcpcd updates in -current.
 it is extremely unlikely dhcpcd uses libsupc++, which
 is only used in some special cases of C++, and dhcpcd
 is not a C++ applicaiton.


 .mrg.

From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on
 netbsd-9/sparc
Date: Mon, 20 Apr 2020 18:06:21 -0500 (CDT)

 On Tue, 21 Apr 2020, matthew green wrote:

 > i suspect this is due to dhcpcd updates in -current.
 > it is extremely unlikely dhcpcd uses libsupc++, which
 > is only used in some special cases of C++, and dhcpcd
 > is not a C++ applicaiton.

 But why did it suddenly also appear in netbsd-9?

 In both cases, it only appeared after applying your hack/patch for this
 PR.

 -- 
 |/"\ 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: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    jdbaker@consolidated.net
Subject: re: port-sparc/54660: undefined reference in libsupc++.a on netbsd-9/sparc
Date: Tue, 21 Apr 2020 15:00:11 +1000

 >  > i suspect this is due to dhcpcd updates in -current.
 >  > it is extremely unlikely dhcpcd uses libsupc++, which
 >  > is only used in some special cases of C++, and dhcpcd
 >  > is not a C++ applicaiton.
 >  
 >  But why did it suddenly also appear in netbsd-9?
 >  
 >  In both cases, it only appeared after applying your hack/patch for this
 >  PR.

 yes - dhcpcd was changed on -9 recently too..


 .mrg.

From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54660 CVS commit: src/external/gpl3/gcc/lib/libsupc++
Date: Tue, 21 Apr 2020 05:23:42 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Tue Apr 21 05:23:42 UTC 2020

 Modified Files:
 	src/external/gpl3/gcc/lib/libsupc++: Makefile

 Log Message:
 pull in atomicity.h (atomicity.cc) on sparc.  3 of the objects
 use these interfaces and this avoids link errors

 fixes PR#54660.


 To generate a diff of this commit:
 cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/gcc/lib/libsupc++/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 21 Apr 2020 16:31:39 +0000
State-Changed-Why:
Does this resolve your issues?


From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sparc/54660 (undefined reference in libsupc++.a on
 netbsd-9/sparc)
Date: Tue, 21 Apr 2020 11:50:15 -0500 (CDT)

 On Tue, 21 Apr 2020, maya@NetBSD.org wrote:

 > Synopsis: undefined reference in libsupc++.a on netbsd-9/sparc
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: maya@NetBSD.org
 > State-Changed-When: Tue, 21 Apr 2020 16:31:39 +0000
 > State-Changed-Why:
 > Does this resolve your issues?

 I've updated -current post-commit and am building a release now.
 Once done and target updated, will test-build the trouble package.

 Will also need to wait for pull-up to netbsd-9 to be completed and
 perform the same steps as above.

 -- 
 |/"\ 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: port-sparc/54660 (undefined reference in libsupc++.a on
 netbsd-9/sparc)
Date: Wed, 22 Apr 2020 03:03:08 -0500 (CDT)

 On Tue, 21 Apr 2020, John D. Baker wrote:

 > I've updated -current post-commit and am building a release now.
 > Once done and target updated, will test-build the trouble package.

 The problem package ("sysutils/apcupsd") now builds without error on
 sparc-current.

 Just waiting for the pull-up to netbsd-9.

 -- 
 |/"\ 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: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54660 CVS commit: [netbsd-9] src/external/gpl3/gcc/lib/libsupc++
Date: Wed, 22 Apr 2020 18:25:10 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Apr 22 18:25:10 UTC 2020

 Modified Files:
 	src/external/gpl3/gcc/lib/libsupc++ [netbsd-9]: Makefile

 Log Message:
 Pull up following revision(s) (requested by mrg in ticket #843):

 	external/gpl3/gcc/lib/libsupc++/Makefile: revision 1.13

 pull in atomicity.h (atomicity.cc) on sparc.  3 of the objects
 use these interfaces and this avoids link errors

 fixes PR#54660.


 To generate a diff of this commit:
 cvs rdiff -u -r1.12 -r1.12.2.1 src/external/gpl3/gcc/lib/libsupc++/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 22 Apr 2020 20:21:17 +0000
State-Changed-Why:
Confirmed fixed, pulled up to netbsd-9. Thanks for the report, and thanks to mrg for fixing it.


From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54660 CVS commit: src/external/gpl3/gcc/lib
Date: Fri, 22 Jul 2022 21:28:32 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Fri Jul 22 21:28:32 UTC 2022

 Modified Files:
 	src/external/gpl3/gcc/lib/libstdc++-v3: Makefile
 	src/external/gpl3/gcc/lib/libsupc++: Makefile

 Log Message:
 atomicity.cc has moved into libsupc++ for everyone.

 this was a workaround we applied for sparc in PR#54660, and
 now is used for all platforms.


 To generate a diff of this commit:
 cvs rdiff -u -r1.51 -r1.52 src/external/gpl3/gcc/lib/libstdc++-v3/Makefile
 cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc/lib/libsupc++/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.