NetBSD Problem Report #58532

From www@netbsd.org  Thu Aug  1 00:32:56 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 821FE1A923C
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  1 Aug 2024 00:32:56 +0000 (UTC)
Message-Id: <20240801003254.DE2681A923E@mollari.NetBSD.org>
Date: Thu,  1 Aug 2024 00:32:54 +0000 (UTC)
From: phil+netbsd@krylov.eu
Reply-To: phil+netbsd@krylov.eu
To: gnats-bugs@NetBSD.org
Subject: lang/llvm should bring a gcc7-libs dependency when native libstdc++ is too old
X-Send-Pr-Version: www-1.0

>Number:         58532
>Category:       pkg
>Synopsis:       lang/llvm should bring a gcc7-libs dependency when native libstdc++ is too old
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 01 00:35:00 +0000 2024
>Last-Modified:  Thu Aug 01 10:05:00 +0000 2024
>Originator:     Phil Krylov
>Release:        pkgsrc-current
>Organization:
krylov.eu
>Environment:
Linux localhost.localdomain 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
>Description:
On CentOS 7, lang/llvm should depend on gcc7-libs, otherwise building, e.g., devel/cargo-c gives the following output:

https://us-central.manta.mnx.io/pkgsrc/public/reports/Linux/el7/trunk/x86_64/20240730.2238/cargo-c-0.9.32/build.log

>How-To-Repeat:
bmake -C devel/cargo-c bin-install
>Fix:
diff -p -u -r1.98 Makefile
--- lang/llvm/Makefile	6 Jul 2024 15:45:05 -0000	1.98
+++ lang/llvm/Makefile	1 Aug 2024 00:21:05 -0000
@@ -128,6 +128,18 @@ PLIST_SUBST+=	RELEASE_TYPE=${RELEASE_TYP
 CMAKE_ARGS+=	-DPKGSRC_LLVM_PTHREADLIB=-lpthread
 .endif

+# This package will link against libstdc++.so from the pkgsrc GCC when the
+# base OS GCC doesn't meet the minimum requirement. Thus we do this so the
+# appropriate gcc-libs package will be captured as a dependency, otherwise
+# binary packages will be broken.
+# rustc: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/pkg/lib/libLLVM.so.18.1)
+.if ${OPSYS} == "Linux"
+OPSYS_LIBSTDCXX_VERSIONS_CMD=	objdump -p ${_OPSYS_LIB_DIRS:=/libstdc++.so.*} 2>/dev/null | grep -o 'GLIBCXX_[0-9.]*'
+.  if empty(OPSYS_LIBSTDCXX_VERSIONS_CMD:sh:MGLIBCXX_3.4.22)
+USE_PKGSRC_GCC_RUNTIME=	yes
+.  endif
+.endif
+
 .if ${USE_CROSS_COMPILE:U:tl} == "yes"
 TOOL_DEPENDS+=	${PKGNAME}:../../${PKGPATH}
 CMAKE_ARGS+=	-DLLVM_TABLEGEN:STRING=${TOOLBASE:Q}/bin/llvm-tblgen

>Audit-Trail:
From: Jonathan Perkin <jperkin@mnx.io>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/58532: lang/llvm should bring a gcc7-libs dependency when
 native libstdc++ is too old
Date: Thu, 1 Aug 2024 08:13:43 +0100

 * On 2024-08-01 at 01:35 BST, phil+netbsd@krylov.eu wrote:

 >+# This package will link against libstdc++.so from the pkgsrc GCC when the
 >+# base OS GCC doesn't meet the minimum requirement. Thus we do this so the
 >+# appropriate gcc-libs package will be captured as a dependency, otherwise
 >+# binary packages will be broken.
 >+# rustc: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/pkg/lib/libLLVM.so.18.1)
 >+.if ${OPSYS} == "Linux"
 >+OPSYS_LIBSTDCXX_VERSIONS_CMD=	objdump -p ${_OPSYS_LIB_DIRS:=/libstdc++.so.*} 2>/dev/null | grep -o 'GLIBCXX_[0-9.]*'
 >+.  if empty(OPSYS_LIBSTDCXX_VERSIONS_CMD:sh:MGLIBCXX_3.4.22)
 >+USE_PKGSRC_GCC_RUNTIME=	yes
 >+.  endif
 >+.endif

 This isn't the correct fix.  Unfortunately it's a bit more complicated 
 than that.

 USE_PKGSRC_GCC_RUNTIME is a user variable, so packages shouldn't be 
 setting it.  Its purpose is to determine whether the dependency for GCC 
 libraries should come from the -libs package instead of the main GCC 
 package.

 The problem is that the main GCC packages only set DEPMETHOD=build, 
 which in the case of USE_PKGSRC_GCC_RUNTIME=no is wrong, they should be 
 full dependencies so that the runtime libraries are available.

 I'll need to do some testing before making changes, as it's been a while 
 since I used the in-tree GCC packages (mostly because they have issues 
 such as this).

 We should also consider just making USE_PKGSRC_GCC_RUNTIME=yes the 
 default.

 -- 
 Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
 Open Source Complete Cloud   www.tritondatacenter.com

From: Jonathan Perkin <jperkin@mnx.io>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
	phil+netbsd@krylov.eu
Subject: Re: pkg/58532: lang/llvm should bring a gcc7-libs dependency when
 native libstdc++ is too old
Date: Thu, 1 Aug 2024 09:29:40 +0100

 Initial patchset up for review and testing:

    https://github.com/TritonDataCenter/pkgsrc/commit/0146081aa0c2900908f4ffdf82e64eb7c6810cb3

 I'll try and get this pushed through a full pkgsrc-el7 bulk build.

 -- 
 Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
 Open Source Complete Cloud   www.tritondatacenter.com

From: Phil Krylov <phil+netbsd@krylov.eu>
To: gnats-bugs@netbsd.org
Cc: Jonathan Perkin <jperkin@mnx.io>
Subject: Re: pkg/58532: lang/llvm should bring a gcc7-libs dependency when
 native libstdc++ is too old
Date: Thu, 01 Aug 2024 11:49:34 +0200

 On 2024-08-01 09:15, Jonathan Perkin wrote:
 >  USE_PKGSRC_GCC_RUNTIME is a user variable, so packages shouldn't be
 >  setting it.

 Thanks! I found the snippet my patch was based on (setting 
 USE_PKGSRC_GCC_RUNTIME) in several other places:

 finance/bitcoin/Makefile
 ham/gnuradio-core/Makefile.common
 mk/compiler/gcc.mk
 print/poppler/Makefile.common

 Shouldn't these be also fixed?

 -- Ph.

From: Jonathan Perkin <jperkin@mnx.io>
To: Phil Krylov <phil+netbsd@krylov.eu>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/58532: lang/llvm should bring a gcc7-libs dependency when
 native libstdc++ is too old
Date: Thu, 1 Aug 2024 11:01:06 +0100

 * On 2024-08-01 at 10:50 BST, Phil Krylov wrote:

 >Thanks! I found the snippet my patch was based on (setting 
 >USE_PKGSRC_GCC_RUNTIME) in several other places:
 >
 >finance/bitcoin/Makefile
 >ham/gnuradio-core/Makefile.common
 >mk/compiler/gcc.mk
 >print/poppler/Makefile.common
 >
 >Shouldn't these be also fixed?

 Yeh, these are all wrong (except mk/compiler/gcc.mk, that's where the 
 logic is defined).

 -- 
 Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
 Open Source Complete Cloud   www.tritondatacenter.com

NetBSD Home
NetBSD PR Database Search

(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-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.