NetBSD Problem Report #40692

From www@NetBSD.org  Thu Feb 19 16:07:25 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id C7D0663C0CF
	for <gnats-bugs@gnats.netbsd.org>; Thu, 19 Feb 2009 16:07:25 +0000 (UTC)
Message-Id: <20090219160725.4BC9363BB35@narn.NetBSD.org>
Date: Thu, 19 Feb 2009 16:07:25 +0000 (UTC)
From: joern.clausen@uni-bielefeld.de
Reply-To: joern.clausen@uni-bielefeld.de
To: gnats-bugs@NetBSD.org
Subject: imake, Solaris and GCC
X-Send-Pr-Version: www-1.0

>Number:         40692
>Category:       pkg
>Synopsis:       imake, Solaris and GCC
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    joerg
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 19 16:10:00 +0000 2009
>Last-Modified:  Wed Aug 31 16:50:02 +0000 2011
>Originator:     Jörn Clausen
>Release:        
>Organization:
University of Bielefeld
>Environment:
SunOS spare4200 5.10 Generic_120012-14 i86pc i386 i86pc

>Description:
When building packages that use imake on Solaris, using GCC as compiler and modular X11, the resulting binaries are missing a runpath to the X libraries. Examples are sysutils/xdu, x11/xearth and probably others:

$ ldd xearth
        libXt.so.6 =>    (file not found)
        libSM.so.6 =>    /usr/lib/libSM.so.6
        libICE.so.6 =>   /usr/lib/libICE.so.6
        libXext.so.0 =>  /usr/lib/libXext.so.0
        libX11.so.6 =>   (file not found)
        libm.so.2 =>     /lib/libm.so.2
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libc.so.1 =>     /lib/libc.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libX11.so.4 =>   /usr/openwin/lib/libX11.so.4
        libmp.so.2 =>    /lib/libmp.so.2
        libmd.so.1 =>    /lib/libmd.so.1
        libscf.so.1 =>   /lib/libscf.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1

The libraries found in /usr/lib (SM, ICE, Xext) are wrong, i.e. not the ones originally linked against.

The reason is, that imake defines the runpath by setting LD_RUN_PATH. This is ignored, because GCC internally passes the option '-R /path/to/gccs/libraries' to the linker, which takes precedence over LD_RUN_PATH, i.e. the latter is ignored.
>How-To-Repeat:

>Fix:
The imake rules are too convoluted for me to understand. This

#ifdef HasGcc3
#define HasLdRunPath NO
#endif

in sun.cf turns off defining LD_RUN_PATH, but I can't find the magic formula to insert linker flags like "-R$(USRLIBDIRPATH)" or "-Wl,-R$(USRLIBDIRPATH)".

Note that e.g. graphics/xfig (see patch-ab) just Pull a Homer by unconditional changes like this:

-XPMLIBS = -L$(XPMLIBDIR) -lXpm
+XPMLIBS = -Wl,-R$(XPMLIBDIR) -L$(XPMLIBDIR) -lXpm

Otherwise this package would be affected as well.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->solaris-pkg-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Thu, 19 Feb 2009 16:17:25 +0000
Responsible-Changed-Why:
Solaris pkgsrc problem.


From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joernc@googlemail.com>
To: gnats-bugs@netbsd.org
Cc: solaris-pkg-people@netbsd.org, pkg-manager@netbsd.org, 
	pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org, wiz@netbsd.org, 
	joern.clausen@uni-bielefeld.de
Subject: Re: pkg/40692 (imake, Solaris and GCC)
Date: Thu, 19 Feb 2009 19:09:28 +0100

 > Solaris pkgsrc problem.

 Please reassign this PR. This is *not* a Solaris problem, this is an
 imake problem.

 -- 
 Joern Clausen
 joernc@gmail.com
 http://www.oe-files.de/oefiles/
 http://thebloeg.blogspot.com/

Responsible-Changed-From-To: solaris-pkg-people->joerg
Responsible-Changed-By: obache@NetBSD.org
Responsible-Changed-When: Thu, 19 Feb 2009 22:22:34 +0000
Responsible-Changed-Why:
Problem on devel/imake and/or x11/xorg-cf-files?


From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/40692
Date: Wed, 31 Aug 2011 14:33:13 +0200

 This fix in x11/xorg-cf-files should do it

 --- sunLib.tmpl.orig    2006-07-11 03:03:04.000000000 +0000
 +++ sunLib.tmpl
 @@ -11,6 +11,8 @@ XCOMM $XFree86: xc/config/cf/sunLib.tmpl
    * SunOS shared library template
    */

 +#define LdPreLib -L$(BUILDLIBDIR) -L$(USRLIBDIR) -R$(USRLIBDIR)
 +
   #if OSMajorVersion <= 4

   # if SunPost411FCSLd


 Tested with x11/xless and sysutils/xdu on Solaris 10.

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/40692
Date: Wed, 31 Aug 2011 14:53:11 +0200

 On Wed, Aug 31, 2011 at 12:35:01PM +0000, Jörn Clausen wrote:
 >  This fix in x11/xorg-cf-files should do it
 >  
 >  --- sunLib.tmpl.orig    2006-07-11 03:03:04.000000000 +0000
 >  +++ sunLib.tmpl
 >  @@ -11,6 +11,8 @@ XCOMM $XFree86: xc/config/cf/sunLib.tmpl
 >     * SunOS shared library template
 >     */
 >  
 >  +#define LdPreLib -L$(BUILDLIBDIR) -L$(USRLIBDIR) -R$(USRLIBDIR)
 >  +
 >    #if OSMajorVersion <= 4
 >  
 >    # if SunPost411FCSLd
 >  
 >  
 >  Tested with x11/xless and sysutils/xdu on Solaris 10.

 Can you test with -Wl,-rpath,$(USRLIBDIR) instead of -R? Just to make
 sure, but that is less compiler dependent.

 Joerg

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: Joerg Sonnenberger <joerg@britannica.bec.de>, joerg@NetBSD.org,
 gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/40692
Date: Wed, 31 Aug 2011 15:52:12 +0200

 >   Can you test with -Wl,-rpath,$(USRLIBDIR) instead of -R? Just to make
 >   sure, but that is less compiler dependent.

 Nope, Sun's ld does not know -rpath. '-Wl,-R,$(USRLIBDIR)' did work, though.

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@netbsd.org
Cc: joerg@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, 
	joern.clausen@uni-bielefeld.de
Subject: Re: pkg/40692
Date: Wed, 31 Aug 2011 19:29:59 +0300

 > =A0> =A0 Can you test with -Wl,-rpath,$(USRLIBDIR) instead of -R? Just to=
  make
 > =A0> =A0 sure, but that is less compiler dependent.
 >
 > =A0Nope, Sun's ld does not know -rpath. '-Wl,-R,$(USRLIBDIR)' did work, t=
 hough.

 pkgsrc passes compiler/linker-specific variables
 COMPILER_RPATH_FLAG/LINKER_RPATH_FLAG to make
 program using MAKE_ENV.
 Use one of them for better portability.

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: joerg@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
	joern.clausen@uni-bielefeld.de
Subject: Re: pkg/40692
Date: Wed, 31 Aug 2011 18:49:09 +0200

 On Wed, Aug 31, 2011 at 01:55:02PM +0000, Jörn Clausen wrote:
 > The following reply was made to PR pkg/40692; it has been noted by GNATS.
 > 
 > From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
 > To: gnats-bugs@NetBSD.org
 > Cc: Joerg Sonnenberger <joerg@britannica.bec.de>, joerg@NetBSD.org,
 >  gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
 > Subject: Re: pkg/40692
 > Date: Wed, 31 Aug 2011 15:52:12 +0200
 > 
 >  >   Can you test with -Wl,-rpath,$(USRLIBDIR) instead of -R? Just to make
 >  >   sure, but that is less compiler dependent.
 >  
 >  Nope, Sun's ld does not know -rpath. '-Wl,-R,$(USRLIBDIR)' did work, though.

 Good enough, thanks.

 Joerg

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.