NetBSD Problem Report #45256

From www@NetBSD.org  Mon Aug 15 07:41:00 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id B00DE63B978
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 15 Aug 2011 07:40:59 +0000 (UTC)
Message-Id: <20110815074059.1B10263B89A@www.NetBSD.org>
Date: Mon, 15 Aug 2011 07:40:59 +0000 (UTC)
From: joern.clausen@uni-bielefeld.de
Reply-To: joern.clausen@uni-bielefeld.de
To: gnats-bugs@NetBSD.org
Subject: lang/gcc46 not working properly on Solaris
X-Send-Pr-Version: www-1.0

>Number:         45256
>Category:       pkg
>Synopsis:       lang/gcc46 not working properly on Solaris
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    solaris-pkg-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 15 07:45:00 +0000 2011
>Closed-Date:    
>Last-Modified:  Tue Dec 06 21:15:02 +0000 2011
>Originator:     Jörn Clausen
>Release:        
>Organization:
University of Bielefeld
>Environment:
>Description:
Building lang/gcc46 on Solaris 10 using the Sun Compiler Studio cc seems to work - at first sight. The only problem are shared objects depending on libgcc_s.so. The correct runtime path is missing.

In my case, libgcc_s.so is installed in

/usr/pkgsrc/20110809/gcc46/lib/libgcc_s.so.1

yet this is the runpath of a shared object:

$ dump -Lv /usr/pkgsrc/20110809/lib/libxml2.so.2.7.8 | grep PATH
[11]    RUNPATH         /usr/pkgsrc/20110809/lib
[12]    RPATH           /usr/pkgsrc/20110809/lib

Compare this to gcc34 from an older installation: libgcc_s.so is installed in

/usr/pkgsrc/20101105/gcc34/lib/libgcc_s.so.1

and the runpath is correctly

$ dump -Lv /usr/pkgsrc/20101105/lib/libxml2.so.2.7.8 | grep PATH
[11]    RUNPATH         /usr/pkgsrc/20101105/lib:/usr/pkgsrc/20101105/gcc34/lib
[12]    RPATH           /usr/pkgsrc/20101105/lib:/usr/pkgsrc/20101105/gcc34/lib

After installing lang/gcc46, I reinstalled devel/libtool-base.

And I removed the dependency on devel/binutils, as Solaris' ld is still the preferred linker.
>How-To-Repeat:

>Fix:
A symlink from pkgsrc's standard lib directory to gcc's would be a workaround.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->solaris-pkg-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Mon, 15 Aug 2011 21:10:40 +0000
Responsible-Changed-Why:
Solaris pkgsrc problem.


From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Tue, 16 Aug 2011 21:17:31 +0200

 --AhhlLboLdkugWU4S
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Mon, Aug 15, 2011 at 07:45:00AM +0000, joern.clausen@uni-bielefeld.de wrote:
 > >Number:         45256
 > >Category:       pkg
 > >Synopsis:       lang/gcc46 not working properly on Solaris

 Can you please try the attached diff (against pkgsrc-current)?
 (From Kai-Uwe Eckhardt based on gcc44 changes by hans@)
 (I'm not exactly sure where to put the binutils/libelf lines,
 move them around if you end up with missing dependencies.)
  Thomas

 --AhhlLboLdkugWU4S
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="gcc46.diff"

 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/gcc46/Makefile,v
 retrieving revision 1.2
 diff -u -r1.2 Makefile
 --- Makefile	13 Aug 2011 14:06:22 -0000	1.2
 +++ Makefile	16 Aug 2011 19:16:08 -0000
 @@ -39,6 +39,14 @@
  .include "options.mk"

  # Determine whether to use binutils
 +.if ${OPSYS} == "SunOS"
 +CONFIGURE_ARGS+=	--without-gnu-ld --with-ld=/usr/bin/ld
 +. if !exists(/usr/bin/gas)
 +CONFIGURE_ARGS+=	--without-gnu-as --with-as=/usr/bin/as
 +. else
 +CONFIGURE_ARGS+=	--with-gnu-as --with-as=/usr/bin/gas
 +.endif
 +.endif

  # REPLACE_AWK+=	gcc/testsuite/gcc.test-framework/test-framework.awk	\
  # 		gcc/mkmap-symver.awk					\
 @@ -110,12 +118,11 @@
  CONFIGURE_ARGS+=	--with-ld=${PREFIX}/bin/gnu-ld
  CONFIGURE_ARGS+=	--with-libelf=${PREFIX}
  MAKE_ENV+=		ac_cv_func_clock_gettime=yes
 +.include "../../devel/binutils/buildlink3.mk"
 +.include "../../devel/libelf/buildlink3.mk"
  .endif
  .if ${OPSYS} == "Linux"
  CONFIGURE_ARGS+=	--disable-libquadmath --disable-libquadmath-support
 -.else
 -.include "../../devel/binutils/buildlink3.mk"
 -.include "../../devel/libelf/buildlink3.mk"
  .endif

  CONFIGURE_ENV+=		CONFIG_SHELL=${CONFIG_SHELL}

 --AhhlLboLdkugWU4S--

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: Thomas Klausner <wiz@NetBSD.org>, solaris-pkg-people@NetBSD.org,
 gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Wed, 17 Aug 2011 08:56:34 +0200

 >    # Determine whether to use binutils
 >   +.if ${OPSYS} == "SunOS"
 >   +CONFIGURE_ARGS+=	--without-gnu-ld --with-ld=/usr/bin/ld
 >   +. if !exists(/usr/bin/gas)
 >   +CONFIGURE_ARGS+=	--without-gnu-as --with-as=/usr/bin/as
 >   +. else
 >   +CONFIGURE_ARGS+=	--with-gnu-as --with-as=/usr/bin/gas
 >   +.endif
 >   +.endif

 On Solaris 10 and earlier, ld is found in /usr/ccs/bin/ld. /usr/bin/ld 
 is maybe present on Solaris 11 or some of the OpenSolaris heirs. The 
 same goes for GNU software. Up until Solaris 10, this maybe present in 
 /usr/sfw/bin/, but not in /usr/bin/.

 And I tried both versions: Using Solaris' ld, and keeping binutils as 
 dependency. The latter made problems nearly immediately, the first one 
 had problems handling "hidden attributes". I'll do extensive tests again 
 and post my results. BTW: lang/gcc34 doesn't work either at the moment, 
 so I am out of a working bootstrap process.

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

From: "Filip Hajny" <filip@joyent.com>
To: =?iso-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
Cc: <gnats-bugs@NetBSD.org>,
	"Thomas Klausner" <wiz@NetBSD.org>,
	<solaris-pkg-people@NetBSD.org>,
	<gnats-admin@NetBSD.org>,
	<pkgsrc-bugs@NetBSD.org>
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Wed, 17 Aug 2011 12:51:56 +0200

 > On Solaris 10 and earlier, ld is found in /usr/ccs/bin/ld. /usr/bin/ld is=
  maybe present on Solaris 11 or some of the OpenSolaris heirs. The same goe=
 s for GNU software. Up until Solaris 10, this maybe present in /usr/sfw/bin=
 /, but not in /usr/bin/.

 It's at /usr/bin/ld since Nevada, and stays so on Illumos and similar flavo=
 rs too.

 > And I tried both versions: Using Solaris' ld, and keeping binutils as dep=
 endency. The latter made problems nearly immediately, the first one had pro=
 blems handling "hidden attributes". I'll do extensive tests again and post =
 my results. BTW: lang/gcc34 doesn't work either at the moment, so I am out =
 of a working bootstrap process.

 Any Sun ld won't support visibility. Most affected software configures will=
  only check for the version of GCC and seeing 4.x something they try to ena=
 ble visibility support, which will fail for sure. So visibility needs to be=
  checked for on a package level and patched away.

 I don't think pkgsrc currently has any variable to report the flavor of ld =
 available/used. Maybe something like GNU_LINKER would make things a bit eas=
 ier?

 -F=

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: Filip Hajny <filip@joyent.com>, solaris-pkg-people@NetBSD.org,
 gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Thu, 18 Aug 2011 09:20:40 +0200

 Hi!

 I just bootstrapped with GCC 4.6.1, and now RPATH contains the correct 
 directory for libgcc_s.so again. That's very good.

 On 08/17/11 12:55 PM, Filip Hajny wrote:
 >   Any Sun ld won't support visibility. Most affected software configures will=
 >    only check for the version of GCC and seeing 4.x something they try to ena=
 >   ble visibility support, which will fail for sure. So visibility needs to be=
 >    checked for on a package level and patched away.

 I can't say I really understand these changes in GCC 4.6.1, but they 
 sound like good news as well:

 http://gcc.gnu.org/gcc-4.6/changes.html#solaris

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

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Thu, 18 Aug 2011 10:13:26 +0200

 The update to GCC 4.6.1 seems to fix the main problem. As Filip 
 mentioned, the remaining problems have to tackled per package.

 Please update _GCC_DIST_VERSION to 4.6.1 in mk/compiler/gcc.mk and close 
 this PR.

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

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Thu, 18 Aug 2011 11:41:53 +0000
State-Changed-Why:
_GCC_DIST_VERSION fixed as suggested, thanks!


From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: solaris-pkg-people@NetBSD.org, gnats-admin@NetBSD.org,
 pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Thu, 18 Aug 2011 13:58:39 +0200

 Sorry, it's not over yet...

 GCC 4.6.1 seems to work for most packages, because libtool reinserts 
 $GCCDIR/lib into the runpath, not the compiler itself. An old, working 
 GCC 3.4.6 reports via -dumpspecs:

 *link_libgcc:
 %D -R /usr/pkgsrc/20101105/gcc34/lib

 But GCC 4.6.1 shows

 *link_libgcc:
 %D

 I noticed this with packages passing an explicit runpath via libtool, 
 e.g. lang/tcl.

 I am just rebuilding lang/gcc46 with a patch equivalent to 
 lang/gcc34/patches/patch-cc. I hope that this will finally fix all problems.

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

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: solaris-pkg-people@NetBSD.org, gnats-admin@NetBSD.org,
 pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Thu, 18 Aug 2011 16:45:59 +0200

 Please add this patch to lang/gcc46

 --- gcc/Makefile.in.orig        2011-05-23 18:12:34.000000000 +0000
 +++ gcc/Makefile.in
 @@ -2190,6 +2190,7 @@ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_
   # Language-independent files.

   DRIVER_DEFINES = \
 +  -DLINK_LIBGCC_SPEC="\"%D $(LINKER_RPATH_FLAG) $(exec_prefix)/lib\"" \
     -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \
     -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
     -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \

 With this, "gcc -dumpspecs" reports the correct rpath for all shared 
 objects using libgcc_s.so. Kudos to the author of 
 lang/gcc34/patches/patch-cc.

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

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: solaris-pkg-people@NetBSD.org, gnats-admin@NetBSD.org,
 pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Fri, 19 Aug 2011 16:00:49 +0200

 The shared libraries found in lang/gcc46 itself (e.g. libstdc++, 
 libgomp, ...) are still broken. They depend on libgcc_s, but don't 
 contain any runpath information at all. So software using any of these 
 features will not work.

 How is this solved in NetBSD's native GCC, anyway? I mean, NetBSD has 
 the same distinction between link-time and run-time found in Solaris, so 
 I'd expect the same problems there.

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

State-Changed-From-To: closed->open
State-Changed-By: tez@NetBSD.org
State-Changed-When: Fri, 19 Aug 2011 15:11:18 +0000
State-Changed-Why:
Not quite fixed yet... see the last comments added.


From: "Filip Hajny" <filip@joyent.com>
To: =?iso-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
Cc: <gnats-bugs@NetBSD.org>,
	<solaris-pkg-people@NetBSD.org>,
	<gnats-admin@NetBSD.org>,
	<pkgsrc-bugs@NetBSD.org>
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Fri, 19 Aug 2011 21:57:19 +0200

 On 19. 8. 2011, at 16:00, J=F6rn Clausen wrote:

 > The shared libraries found in lang/gcc46 itself (e.g. libstdc++, libgomp,=
  ...) are still broken. They depend on libgcc_s, but don't contain any runp=
 ath information at all. So software using any of these features will not wo=
 rk.

 I've hit this some time ago when I started playing with GCC 4.4 on Solaris.=
  I don't remember exactly, but I have a faint memory the conversations that=
  I found back then were along the line of "RPATH is evil - It is not! - It =
 is, you might need to move the libs one day. - So let's use $ORIGIN. - Rubb=
 ish!" At the end, I opted for including the GCC lib path in crle, which see=
 med easier than messing with the GCC specs.

 I never investigated how this is dealt with on other platforms, but I think=
  the fact that runpath is inherited with each link (rather than reset clean=
  as on Solaris) may play its role?

 -F=

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Tue, 23 Aug 2011 13:11:56 +0200

 When setting LD_RUN_PATH to $pkgsrcdir/gcc46/lib while building 
 lang/gcc46, GCC's own libraries are built with correct rpaths, so they 
 find their own libgcc_s:

 $ ldd /pkgsrc/gcc46-ld/gcc46/lib/libstdc++.so.6.0.16
          libm.so.2 =>     /lib/libm.so.2
          libc.so.1 =>     /lib/libc.so.1
          libgcc_s.so.1 =>         /pkgsrc/gcc46-ld/gcc46/lib/libgcc_s.so.1

 At least the 32 bit versions do, the 64 bit versions are broken by 
 definition:

 $ ldd /pkgsrc/gcc46-ld/gcc46/lib/amd64/libstdc++.so.6.0.16
          libm.so.2 =>     /lib/64/libm.so.2
          libc.so.1 =>     /lib/64/libc.so.1
          libgcc_s.so.1 => 
 /pkgsrc/gcc46-ld/gcc46/lib/libgcc_s.so.1  - wrong ELF class: ELFCLASS32

 But this is not worse than the situation before. For me personally, this 
 is close enough to a working GCC as I can get. As pkgsrc does not 
 support mixed ABIs anyway, it might be sufficient to chose either 
 runpath during the build.

 To make this better reproducible, I added

 LDFLAGS+=               -R${GCC_PREFIX}/lib

 to the Makefile, and did not set LD_RUN_PATH, but the resulting 
 libraries where broken again. In the light of the discussion about 
 clearing the environment in pkgsrc, a different solution than setting 
 LD_RUN_PATH is probably needed. Maybe somebody has the 
 knowledge/time/stamina to dive into the makefiles and fix this at the 
 right places.

 All in all, gcc46 on Solaris is severely broken, and I don't expect a 
 true fix anytime soon. I talked to the maintainer of the Solaris 2 port 
 (who also takes care of the IRIX and Tru64 ports), and the differences 
 between all the supported platforms, plus the ignorance of some GCC 
 developers to real world problems (i.e. "it works on my computer") makes 
 it very hard to come up with a real solution.

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

From: "Filip Hajny" <filip@joyent.com>
To: <gnats-bugs@NetBSD.org>
Cc: <solaris-pkg-people@NetBSD.org>,
	<gnats-admin@netbsd.org>,
	<pkgsrc-bugs@netbsd.org>,
	<joern.clausen@uni-bielefeld.de>
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Tue, 23 Aug 2011 18:08:30 +0200

 On 23. 8. 2011, at 13:15, J=F6rn Clausen wrote:

 > But this is not worse than the situation before. For me personally, this=
 =20
 > is close enough to a working GCC as I can get. As pkgsrc does not=20
 > support mixed ABIs anyway, it might be sufficient to chose either=20
 > runpath during the build.

 How about passing -R$ORIGIN (escaped properly)? That should work fine on Su=
 nOS systems.

 Also, a relatively easy workaround for a broken package is to go back to 'c=
 rle' and 'crle -64' and just add the path there.

 -F=

From: =?iso-8859-1?Q?J=F6rn_Clausen?= <joern.clausen@uni-bielefeld.de>
To: Filip Hajny <filip@joyent.com>
Cc: gnats-bugs@NetBSD.org, solaris-pkg-people@NetBSD.org,
 gnats-admin@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/45256: lang/gcc46 not working properly on Solaris
Date: Tue, 23 Aug 2011 22:19:22 +0200

 Am 23.08.2011 um 18:08 schrieb Filip Hajny:
 > How about passing -R$ORIGIN (escaped properly)? That should work fine =
 on SunOS systems.

 I have to check that. Stay tuned...

 > Also, a relatively easy workaround for a broken package is to go back =
 to 'crle' and 'crle -64' and just add the path there.

 YMMD, but for me the most important point in using a source based =
 packaging system is, that I don't have to rely any of these atrocities. =
 If I think crle or LD_LIBRARY_PATH were tolerable solutions, I could =
 just as well use any binary based package collection.

 --=20
 J=F6rn Clausen                             =
 joern.clausen@uni-bielefeld.de
 Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
 Universit=E4t Bielefeld

From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45256 CVS commit: pkgsrc/mk/compiler
Date: Thu, 18 Aug 2011 10:01:31 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Thu Aug 18 10:01:31 UTC 2011

 Modified Files:
 	pkgsrc/mk/compiler: gcc.mk

 Log Message:
 Update _GCC_DIST_VERSION to 4.6.1.
 Noted by Jörn Clausen in PR 45256.


 To generate a diff of this commit:
 cvs rdiff -u -r1.109 -r1.110 pkgsrc/mk/compiler/gcc.mk

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

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