NetBSD Problem Report #57615

From  Mon Sep 11 03:27:23 2023
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id DDA0D1A9238
	for <>; Mon, 11 Sep 2023 03:27:23 +0000 (UTC)
Message-Id: <>
Date: Mon, 11 Sep 2023 03:27:22 +0000 (UTC)
Subject: Install ldscript as to handle dependencies b/w libraries
X-Send-Pr-Version: www-1.0

>Number:         57615
>Category:       lib
>Synopsis:       Install ldscript as to handle dependencies b/w libraries
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 11 03:30:01 +0000 2023
>Originator:     Rin Okuyama
>Release:        10.99.7
Internet Initiative Japan Inc.
NetBSD netbsd 10.99.7 NetBSD 10.99.7 (AMD64_NET_MPSAFE) #2: Tue Aug 15 12:13:48 JST 2023  rin@netbsd:/home/rin/src/sys/arch/amd64/compile/AMD64_NET_MPSAFE amd64
Currently, we locally enable --copy-dt-needed-entries by default for
ld(1) to handle dependencies between shared libraries:

Without this workaround, for example, symbols from
cannot be resolved for curses(3) based applications, unless -lterminfo
is explicitly specified. See, e.g., PR lib/57592:

Another candidate fix should be to add -Wl,--copy-dt-needed-entries to
LDFLAGS in /usr/share/mk/ Then, this flag is enabled when
compiling 3rd party applications, as long as their build frameworks
(configure etc.) respect LDFLAGS.

However, IMO, more better fix should be install dedicated ldscripts for
such libraries, instead of hacking around global ld(1) flags. That is,
for the case of libcurses, provide this script

INPUT(/usr/lib/ AS_NEEDED(-lterminfo))

as /usr/lib/ Then, -lterminfo is automatically specified
for -lcurses. And this is what FreeBSD does, which has separated
libncursesw and libtinfow recently with this trick:

I think we can generate such a ldscript by using LIBDPLIBS (not only
just for libcurses, but for other libraries also). Do you think this
is a correct way to go?

Also, we can handle static libraries in a similar manner, but in this
case, we need to change default prefix for library itself, i.e., we
need to reserve libfoo.a as ldscript, and other file name for archive.
Described above.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.