From owner-freebsd-bugs Wed Mar 21 23:30:17 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 042DF37B71F for ; Wed, 21 Mar 2001 23:30:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2M7U2L07591; Wed, 21 Mar 2001 23:30:02 -0800 (PST) (envelope-from gnats) Received: from muscle.twistedcircus.org (cr171252-a.poco1.bc.wave.home.com [24.113.93.54]) by hub.freebsd.org (Postfix) with ESMTP id 5AC9D37B71F for ; Wed, 21 Mar 2001 23:21:07 -0800 (PST) (envelope-from cbond@muscle.twistedcircus.org) Received: (from cbond@localhost) by muscle.twistedcircus.org (8.11.2/8.11.2) id f2M7Lp903660; Wed, 21 Mar 2001 23:21:51 -0800 (PST) (envelope-from cbond) Message-Id: <200103220721.f2M7Lp903660@muscle.twistedcircus.org> Date: Wed, 21 Mar 2001 23:21:51 -0800 (PST) From: cbond@twistedcircus.org Reply-To: cbond@twistedcircus.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: misc/25984: bsd.prog.mk doesn't link C++ programs properly Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 25984 >Category: misc >Synopsis: bsd.prog.mk doesn't link C++ programs properly >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Mar 21 23:30:02 PST 2001 >Closed-Date: >Last-Modified: >Originator: Chris L. Bond >Release: FreeBSD 4.3-BETA i386 >Organization: None >Environment: >Description: bsd.prog.mk from /usr/share/mk/ doesn't properly link programs with C++ source files against -lstdc++ as it should. The majority of C++ programs hence fail to build. >How-To-Repeat: Construct a Makefile in the standard bsd.prog.mk format and include C++ files in the $SRCS variable (.cc, .C, .cxx, etc.). Be sure to use a piece of the C++ standard library in your code (e.g., iostreams). >Fix: --- /usr/src/share/mk/bsd.prog.mk.orig Wed Mar 21 22:30:10 2001 +++ /usr/src/share/mk/bsd.prog.mk Wed Mar 21 23:18:52 2001 @@ -27,10 +27,14 @@ .if defined(PROG) .if defined(SRCS) -# If there are Objective C sources, link with Objective C libraries. +# If there are Objective C or C++ sources, link with appropriate libraries. .if ${SRCS:M*.m} != "" OBJCLIBS?= -lobjc LDADD+= ${OBJCLIBS} +.endif +.if ${SRCS:C/\.(cc\$|C\$|cxx\$|cpp\$)//} != ${SRCS} +CXXLIBS?= -lstdc++ +LDADD+= ${CXXLIBS} .endif OBJS+= ${SRCS:N*.h:R:S/$/.o/g} >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message