Subject: pkg/20697: gcc3 package needs to add its gcc-lib to the rpath
To: None <>
From: None <>
List: netbsd-bugs
Date: 03/14/2003 00:46:37
>Number:         20697
>Category:       pkg
>Synopsis:       The gcc3 package doesn't add its gcc-lib directory to the rpath, causing Fortran and java programs to not work due to runtime linkage failures.
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 13 16:47:01 PST 2003
>Originator:     Thor Lancelot Simon
>Release:        NetBSD 1.6K, pkgsrc as of 2003-03-05
	Stevens Institute of Technology
System: NetBSD 1.6K NetBSD 1.6K (KLOSTER) #17: Wed Mar  5 18:59:25 EST 2003 i386
Architecture: i386
Machine: i386
	GCC-compiled fortran programs require linkage with libg2c.
	GCC-compiled java programs require linkage with libgcj, and so
        forth.  Dynamically-linked programs require linkage against the
	corresponding .so libraries instead of the .a libraries a static
	executable would use.

	Unfortunately, the gcc3 package doesn't modify gcc's 'specs' file
	to add /usr/pkg/gcc-3.2.1/gcc-lib to the rpath at the link stage,
	so Fortran programs (for example) link fine but then fail to run.
	This is particularly obvious (and confusing!) when linking to a 
	GCC-compiled Fortran *library*, for example the MPE libraries.

	Try to build a dynamically-linked Fortran executable, or a
	dynamically-linked *any language* executable that uses a 
	GCC3-compiled library requiring libg2c.  Note that it does not
	work because the dynamic linker can't resolve the dependency.
	I added %{!static:-rpath /usr/pkg/gcc-3.2.1/lib to the *link:
	line in gcc3's "specs" file.  I'm not sure if this is quite
	right; someone who actually understands the file syntax better
	should investigate this.