NetBSD Problem Report #57077

From www@netbsd.org  Sun Oct 30 17:55:06 2022
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 E07B71A921F
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 30 Oct 2022 17:55:05 +0000 (UTC)
Message-Id: <20221030175504.779191A9239@mollari.NetBSD.org>
Date: Sun, 30 Oct 2022 17:55:04 +0000 (UTC)
From: youremailsarecrap@gmail.com
Reply-To: youremailsarecrap@gmail.com
To: gnats-bugs@NetBSD.org
Subject: cwrappers can't handle -Wl,-rpath,/usr/X11R7/lib while normal wrappers can
X-Send-Pr-Version: www-1.0

>Number:         57077
>Category:       pkg
>Synopsis:       cwrappers can't handle -Wl,-rpath,/usr/X11R7/lib while normal wrappers can
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 30 18:00:00 +0000 2022
>Last-Modified:  Sun Nov 13 19:40:01 +0000 2022
>Originator:     Niclas Rosenvik
>Release:        NetBSD 9.2 pkgsrc-current cwrappers-20220403
>Organization:
>Environment:
NetBSD localhost 9.2 NetBSD 9.2 (CAN_KERNEL) #0: Mon Dec 13 17:36:42 CET 2021  niclas@localhost:/usr/src/sys/arch/amd64/compile/CAN_KERNEL amd64
>Description:
When testing to build x11/clisp-gtk2 it fails with:
ld: unrecognised option: -rpath,/usr/X11R7/lib
This is when X11_TYPE=native .
The command arguments to ld includes -Wl,-rpath,/usr/X11R7/lib
Building the same package with USE_CWRAPPERS=no in mk.conf succeeds.

cd:ing into work/.cwrapper/bin and executing:
env CWRAPPERS_CONFIG_DIR=../config ./ld -Wl,-rpath,/usr/X11R7/lib
gives:
ld: unrecognised option: -rpath,/usr/X11R7/lib

In .work.log:
[*] ld -Wl,-rpath,/usr/X11R7/lib
<.> ld -rpath,/usr/X11R7/lib -pie

When USE_CWRAPPERS=no this happens:
cd:ing into work/.wrapper/bin and executing:
./ld -Wl,-rpath,/usr/X11R7/lib
gives:
usr/bin/ld: no input files

In .work.log:
[*] ./ld ./ld -Wl,-rpath,/usr/X11R7/lib
<.> /usr/bin/ld -rpath /usr/X11R7/lib -L/home/nros/pkgsrc/x11/clisp-gtk2/work/.buildlink/lib

This looks more correct to me since it actually transforms the argument into something that ld understands.
>How-To-Repeat:

>Fix:

>Audit-Trail:
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/57077: cwrappers can't handle -Wl,-rpath,/usr/X11R7/lib
 while normal wrappers can
Date: Tue, 1 Nov 2022 18:11:36 +0100

 Am Sun, Oct 30, 2022 at 06:00:01PM +0000 schrieb youremailsarecrap@gmail.com:
 > When testing to build x11/clisp-gtk2 it fails with:
 > ld: unrecognised option: -rpath,/usr/X11R7/lib

 That's correct behavior because the correct command line is
   -rpath /usr/X11R7/lib

 Joerg

From: Niclas Rosenvik <youremailsarecrap@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/57077: cwrappers can't handle -Wl,-rpath,/usr/X11R7/lib while
 normal wrappers can
Date: Mon, 7 Nov 2022 22:45:54 +0100

 Ok I have been doing some more digging into this.
 First of all the cc wrapper seems to be able to take
 -Wl,-rpath,/usr/X11R7/lib so the problem seems to be
 that clisp-link uses ld for linking instead of the compiler.
 So if there is no intention to make cwrappers 100% functional
 compatible with normal wrappers one way to solve
 the problem is to make clisp-link use the compiler for linking.
 On linux and many other platforms it does, see patch-aa in
 lang/clisp .
 The pkg-config files for X11 stuff that is in
 ${WRKSRC}/.buildlink/lib/pkg-config seems to be filled
 with -Wl,-rpath,/usr/X11R7/lib
  so pkg-config stuff is never to be passed to ld directly if
 I understand correctly.



 >That's correct behavior because the correct command line is
 >  -rpath /usr/X11R7/lib

From: "Niclas Rosenvik" <nros@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57077 CVS commit: pkgsrc/lang/clisp
Date: Tue, 8 Nov 2022 12:47:01 +0000

 Module Name:	pkgsrc
 Committed By:	nros
 Date:		Tue Nov  8 12:47:01 UTC 2022

 Modified Files:
 	pkgsrc/lang/clisp: distinfo
 	pkgsrc/lang/clisp/patches: patch-aa

 Log Message:
 clisp: fix module linking with X11_TYPE = native on NetBSD

 X11 pkg-config files on NetBSD includes -Wl,-rpath,/usr/X11R7/lib
 that can't be understood by the ld command, so use the compiler
 that can understand this for linking instead.
 Fixes build of x11/clisp-gtk2 with X11_TYPE = native and cwrappers.
 Concerns PR pkg/57077 .


 To generate a diff of this commit:
 cvs rdiff -u -r1.40 -r1.41 pkgsrc/lang/clisp/distinfo
 cvs rdiff -u -r1.20 -r1.21 pkgsrc/lang/clisp/patches/patch-aa

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

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/57077: cwrappers can't handle -Wl,-rpath,/usr/X11R7/lib
 while normal wrappers can
Date: Sun, 13 Nov 2022 19:37:18 +0000

 On Tue, Nov 01, 2022 at 05:15:01PM +0000, Joerg Sonnenberger wrote:
  >  > When testing to build x11/clisp-gtk2 it fails with:
  >  > ld: unrecognised option: -rpath,/usr/X11R7/lib
  >  
  >  That's correct behavior because the correct command line is
  >    -rpath /usr/X11R7/lib

 Sort of. I mean, it's an invalid argument for ld, but it seems like
 either it should (a) pass it through unchanged in case it's something
 we didn't know about, (b) reject it directly or drop it because it's
 something we don't know about that contains a path, or (c) convert it
 from the form (notionally) cc understands to the form ld understands.

 Apparently the old wrappers did (c), and I agree that's questionable,
 but it seems like now what we get is _part_ of (c) and that seems
 wrong.

 -- 
 David A. Holland
 dholland@netbsd.org

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