NetBSD Problem Report #56163

From www@netbsd.org  Tue May 11 06:48:05 2021
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))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 3E54F1A9273
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 11 May 2021 06:48:05 +0000 (UTC)
Message-Id: <20210511064803.BFF661A9274@mollari.NetBSD.org>
Date: Tue, 11 May 2021 06:48:03 +0000 (UTC)
From: pekdon@gmail.com
Reply-To: pekdon@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Solaris 10 support for GNU ld, missing library path
X-Send-Pr-Version: www-1.0

>Number:         56163
>Category:       pkg
>Synopsis:       Solaris 10 support for GNU ld, missing library path
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    solaris-pkg-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 11 06:50:00 +0000 2021
>Last-Modified:  Sun May 22 23:20:01 +0000 2022
>Originator:     Claes Nästén
>Release:        trunk 2021-05-11
>Organization:
>Environment:
SunOS u40 5.10 Generic_147148-26 i86pc i386 i86pc

>Description:
Using GNU ld form pkgsrc on Solaris 10 x86_64 binaries fail to link due to gld not being able to find /lib/64/libaio.so.

Using the Solaris 10 (unpatched) linker can on the other hand fail with link issues like:

section [12].eh_frame: section type is SHT_PROGBITS: expected SHT_AMD64_UNWIND

Adding /lib/64 and /usr/lib/64 to the linker path resolves the issues making GNU ld an option. 
>How-To-Repeat:
Build GCC (my tests are with GCC 6.5) using the tools from binutils and not the Solaris provided tools.

The build will fail with linker issues. (And other issues, will hopefully be able to provide patches for that) 
>Fix:
diff --git a/devel/binutils/Makefile b/devel/binutils/Makefile
index 21d2fd74b41..04fcc4d675b 100644
--- a/devel/binutils/Makefile
+++ b/devel/binutils/Makefile
@@ -51,6 +51,17 @@ PLIST_VARS+= ctf gas gold gprof ld

 .include "../../mk/bsd.prefs.mk"

+# Solaris x86_64 libaries are located under /lib/64 and /usr/lib/64 and
+# must be available for 64bit applications to link
+.if ${OPSYS} == "SunOS"
+.if exists(/usr/lib/64)
+LIB_PATH:=             /usr/lib/64:${LIB_PATH}
+.endif
+.if exists(/lib/64)
+LIB_PATH:=             /lib/64:${LIB_PATH}
+.endif
+.endif
+
 #
 # libctf does not build on thes platforms at present.
 #

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->solaris-pkg-people
Responsible-Changed-By: hauke@NetBSD.org
Responsible-Changed-When: Tue, 11 May 2021 07:55:44 +0000
Responsible-Changed-Why:
A SunOS problem.


From: Jonathan Perkin <jperkin@joyent.com>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/56163: Solaris 10 support for GNU ld, missing library path
Date: Wed, 12 May 2021 14:53:57 +0100

 * On 2021-05-12 at 14:32 BST, pekdon@gmail.com wrote:

 >+# Solaris x86_64 libaries are located under /lib/64 and /usr/lib/64 and
 >+# must be available for 64bit applications to link
 >+.if ${OPSYS} == "SunOS"
 >+.if exists(/usr/lib/64)
 >+LIB_PATH:=             /usr/lib/64:${LIB_PATH}
 >+.endif
 >+.if exists(/lib/64)
 >+LIB_PATH:=             /lib/64:${LIB_PATH}
 >+.endif
 >+.endif
 >+

 I'm pretty sure we can just use COMPILER_LIB_DIRS for this as intended, 
 rather than duplicating all the logic for each platform, i.e.:

    --- a/devel/binutils/Makefile
    +++ b/devel/binutils/Makefile
    @@ -25,9 +25 @@ GNU_CONFIGURE_STRICT=   no
    -# Standard lib dirs on RHEL are named *lib64
    -LIB_PATH=              /lib:/usr/lib
    -.if exists(/usr/lib64)
    -LIB_PATH:=             /usr/lib64:${LIB_PATH}
    -.endif
    -.if exists(/lib64)
    -LIB_PATH:=             /lib64:${LIB_PATH}
    -.endif
    -CONFIGURE_ARGS+=       --with-lib-path=${LIB_PATH}
    +CONFIGURE_ARGS+=       --with-lib-path=${COMPILER_LIB_DIRS:S/ /:/Wg}

 Untested though, as I never use gld on SunOS.

 -- 
 Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com

From: =?utf-8?q?Claes_N=C3=A4st=C3=A9n?= <pekdon@gmail.com>
To: gnats-bugs <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: pkg/56163: Solaris 10 support for GNU ld, missing library path
Date: Wed, 12 May 2021 18:25:23 +0200

 Excerpts from Jonathan Perkin's message of 2021-05-12 13:55:01 +0000:
 > The following reply was made to PR pkg/56163; it has been noted by GNATS.
 > 
 > From: Jonathan Perkin <jperkin@joyent.com>
 > To: gnats-bugs@netbsd.org
 > Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
 > Subject: Re: pkg/56163: Solaris 10 support for GNU ld, missing library path
 > Date: Wed, 12 May 2021 14:53:57 +0100
 > 
 >  * On 2021-05-12 at 14:32 BST, pekdon@gmail.com wrote:
 >  
 >  >+# Solaris x86_64 libaries are located under /lib/64 and /usr/lib/64 and
 >  >+# must be available for 64bit applications to link
 >  >+.if ${OPSYS} == "SunOS"
 >  >+.if exists(/usr/lib/64)
 >  >+LIB_PATH:=             /usr/lib/64:${LIB_PATH}
 >  >+.endif
 >  >+.if exists(/lib/64)
 >  >+LIB_PATH:=             /lib/64:${LIB_PATH}
 >  >+.endif
 >  >+.endif
 >  >+
 >  
 >  I'm pretty sure we can just use COMPILER_LIB_DIRS for this as intended, 
 >  rather than duplicating all the logic for each platform, i.e.:
 >  
 >     --- a/devel/binutils/Makefile
 >     +++ b/devel/binutils/Makefile
 >     @@ -25,9 +25 @@ GNU_CONFIGURE_STRICT=   no
 >     -# Standard lib dirs on RHEL are named *lib64
 >     -LIB_PATH=              /lib:/usr/lib
 >     -.if exists(/usr/lib64)
 >     -LIB_PATH:=             /usr/lib64:${LIB_PATH}
 >     -.endif
 >     -.if exists(/lib64)
 >     -LIB_PATH:=             /lib64:${LIB_PATH}
 >     -.endif
 >     -CONFIGURE_ARGS+=       --with-lib-path=${LIB_PATH}
 >     +CONFIGURE_ARGS+=       --with-lib-path=${COMPILER_LIB_DIRS:S/ /:/Wg}
 >  
 >  Untested though, as I never use gld on SunOS.
 >  

 Tried it out and seems to be working fine on my Ultra 40 running
 Solaris 10. (and, gld is used as the equivalent patch of what OS-1551
 fixed is not on my system)

 /Claes

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56163: Solaris 10 support for GNU ld, missing library path
Date: Sun, 22 May 2022 23:19:16 +0000

 On Wed, May 12, 2021 at 04:30:02PM +0000, Claes N?st?n wrote:
  >  >  I'm pretty sure we can just use COMPILER_LIB_DIRS for this as intended, 
  >  >  rather than duplicating all the logic for each platform, i.e.:
  >  >  
  >  >     --- a/devel/binutils/Makefile
  >  >     +++ b/devel/binutils/Makefile
  >  >     @@ -25,9 +25 @@ GNU_CONFIGURE_STRICT=   no
  >  >     -# Standard lib dirs on RHEL are named *lib64
  >  >     -LIB_PATH=              /lib:/usr/lib
  >  >     -.if exists(/usr/lib64)
  >  >     -LIB_PATH:=             /usr/lib64:${LIB_PATH}
  >  >     -.endif
  >  >     -.if exists(/lib64)
  >  >     -LIB_PATH:=             /lib64:${LIB_PATH}
  >  >     -.endif
  >  >     -CONFIGURE_ARGS+=       --with-lib-path=${LIB_PATH}
  >  >     +CONFIGURE_ARGS+=       --with-lib-path=${COMPILER_LIB_DIRS:S/ /:/Wg}
  >  >  
  >  >  Untested though, as I never use gld on SunOS.
  >  >  
  >  
  >  Tried it out and seems to be working fine on my Ultra 40 running
  >  Solaris 10. (and, gld is used as the equivalent patch of what OS-1551
  >  fixed is not on my system)

 Can someone check that this doesn't explode on Linux? It hasn't been
 committed but if it doesn't cause fallout it should be.

 -- 
 David A. Holland
 dholland@netbsd.org

>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.