From owner-freebsd-hackers Sun May 11 12:09:33 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id MAA09527 for hackers-outgoing; Sun, 11 May 1997 12:09:33 -0700 (PDT) Received: from austin.polstra.com (austin.polstra.com [206.213.73.10]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id MAA09486 for ; Sun, 11 May 1997 12:07:56 -0700 (PDT) Received: from austin.polstra.com (jdp@localhost) by austin.polstra.com (8.8.5/8.8.5) with ESMTP id MAA15415; Sun, 11 May 1997 12:07:45 -0700 (PDT) Message-Id: <199705111907.MAA15415@austin.polstra.com> To: dufault@hda.com Subject: Re: g++ shared library segfaults (SOLUTION) Newsgroups: polstra.freebsd.hackers In-Reply-To: <199705111143.HAA29259@hda.hda.com> References: <199705111143.HAA29259@hda.hda.com> Organization: Polstra & Co., Seattle, WA Cc: hackers@freebsd.org Date: Sun, 11 May 1997 12:07:45 -0700 From: John Polstra Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In article <199705111143.HAA29259@hda.hda.com>, Peter Dufault wrote: > Now back to the question at hand: David Nugent correctly guessed > that I wasn't linking the shared libraries properly and the > static constructors weren't executing. Yes - don't overlook > the prepending of ${DESTDIR}/usr/lib/c++rt0.o to SOBJS on older > systems or the or the use of "gcc -shared" in -current. The "right" way to do it on older systems is to set "CPLUSPLUSLIB=true" in the Makefile (assuming that is being used). If you're not using then yes, it's necessary to manually link in c++rt0.o for C++ shared libraries. As you mentioned, on recent -current systems, "gcc -shared" does the right thing, and CPLUSPLUSLIB is not needed. I'm going to bring that same functionality into the -2.2 branch soon. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-knowledge is always bad news." -- John Barth