Subject: pkg/21226: lang/gcc3 doesn't add rpath option for shared runtimes
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tv@pobox.com>
List: netbsd-bugs
Date: 04/18/2003 11:18:12
>Number:         21226
>Category:       pkg
>Synopsis:       lang/gcc3 doesn't add rpath option for shared runtimes
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 18 15:20:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Todd Vierling
>Release:        NetBSD 1.6.1
>Organization:
	DUH.ORG:  Pointing out the obvious since 1994.
>Environment:
>Description:

This is actually a failure in gcc itself, but it's exacerbated by the fact
that lang/gcc3 installs in $PREFIX/gcc-3.2.2/... rather than just $PREFIX.  
Since only $PREFIX/lib is made part of the rpath when compiling pkgsrc
programs, trivial things like libgcc_s, libstdc++, libg2c, and libgcj fail
to link at runtime because of lack of the appropriate rpath option.

>How-To-Repeat:

$ cd /usr/pkgsrc/lang/gcc && make install
...
$ echo 'int main(void) {}' >test.cc
$ /usr/pkg/gcc-3.2.2/bin/g++ -o test test.cc
$ ./test
Shared object "libstdc++.so.5" not found

>Fix:

The following method overrides "libgcc_link_spec" in the generated specs
file, which gives you a compiler that automatically inserts the correct
rpath argument at link time.  This should work for any pkgsrc target
platform, as no platform-specific config overrides it.

Additionally, part of this fix changes the "scrubbed" LDFLAGS by
overriding that in CONFIGURE_ENV, rather than globally.  Other changes to
the pkgsrc Makefile (including one I plan to submit for threads support)
may need access to the "real" LDFLAGS, so overriding it wholesale in the
pkg Makefile is Bad.

===== Makefile.diff ===== (bump PKGREVISION after applying)
begin 644 Makefile.diff.gz
M'XL(`)<5H#X``Z6/VVJ#0!"&K]VGF-K>F=W5F)!$$$S-`6E.:%MZ)XFN9M&H
MK"8IE+Q[U](T4'K789CAAV]F_O&*F+U;L-QF+.$Y0_;_`_EN`.TR"VATJD59
M-K3*TEI$--\6*4VCR*37@YT3$JP1G)UXD8*0K>9E`089H9@G">`C8"'5S2'&
M^$<H75TWJ=ZC1@_TGF7J5M=0VEE-T_Z`AF#T+<.PC#YR',`#LS,`3=8A.`X"
MPHLH/\8,5$*HS$-&=W5,I'5RR%0$".Z_=L).?E0W8EO!F3=[B,I#)<\(N+-!
M_@956==\ES."\&(R6XSG@:TH#Q]A\.Q[FU:'KGM!FKM>S;SYBS\-IZM7S5:N
MK/H;59&V'#]=L;GKAAM_.O/>6O*F+M\.UP6L6/,83#K0[%EK"'?)J$],2$IA
,M03Z!(;"QF#T`0``
`
end

===== patches/patch-ab ===== (regen makepatchsum after adding)
begin 644 patch-ab.gz
M'XL("$[QGSX``W!A=&-H+6%B`&6046^",!"`G]=?<6$LD;`BZL(,B8E("S9C
M:(`M/I`TB!UIYJH!]?>ODCVX[:6]:[_O[EHS%:=%3DR$,,;0U/7PM?H4'W(O
M'*F<0RN;NZB5$!Q;&$W!G?H3SW>?8.RZ$V3;]E\#S>>`1^.)]^B!W>_/H(]J
MW(FO2IUDW3D'\'_E-9B#<)5&+.9+!/>05*HY5XW`4NW$4>A%G>!:OG,0("`9
M>Z<9)S1B*<UA!B6R`3!)6/K"$[:(PY#G:QK.C-)X(+IVM@Z*)8^2(+;,P?5V
MG6EW8PWW<EL:AO;AZN=%D)(@(UP'61&QA/Z`L](P!V>EZ>Z\W<G6&I;_);JA
MX2VOZ1[5WX-U?*/HP8.WI."Z2TP+KM^2LU7:2Q?1=O*@K![^!K.,`Z>9`0``
`
end

>Release-Note:
>Audit-Trail:
>Unformatted: