NetBSD Problem Report #26146

Received: (qmail 11264 invoked by uid 605); 2 Jul 2004 23:14:46 -0000
Message-Id: <200407022314.i62NEhQL009654@knox.mines.edu>
Date: Fri, 2 Jul 2004 17:14:43 -0600 (MDT)
From: jbernard@mines.edu
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: jbernard@mines.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: Changes to make parallel/pvm3 build under Darwin
X-Send-Pr-Version: 3.95

>Number:         26146
>Category:       pkg
>Synopsis:       Changes to make parallel/pvm3 build under Darwin
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    darwin-pkg-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 02 23:15:00 +0000 2004
>Closed-Date:    Sun Jul 18 18:06:20 +0000 2004
>Last-Modified:  Sun Jul 18 18:06:20 +0000 2004
>Originator:     Jim Bernard
>Release:        pkgsrc as of Fri Jul  2 09:37:43 UTC 2004
>Organization:
>Environment:
System: Mac OS X 10.3.4
Architecture: ppc
Machine: ppc
>Description:
	The pvm package needs a few modifications to get it to build
	under Darwin.

>How-To-Repeat:
	Try it.

>Fix:
	arch.mk: Recognize Darwin and set _PVM_OPSYS and _PVM_ARCH
	  appropriately.

	These introduce 4 new patches to the patches directory:

	work/pvm3/conf/DARWIN.def: Incorporate RSHCOMMAND like the
	  NetBSD .def files do.  Eliminate FAKEXDRFLOAT (no longer
	  needed---this source is pretty old) and the -I flag (also
	  no longer needed).  Add flags to eliminate /usr/local/include
	  from the system paths searched by cpp (see PR 26143 for
	  details; since aimk is used here, the change to sys.mk
	  given in that PR is not sufficient to eliminate
	  /usr/local/include in this build; but maybe buildlink3
	  could be modified to handle it).

	work/pvm3/tracer/{tracer.h,trclib.h,trcsort.c}: Include
	  stdlib.h instead of malloc.h if HASSTDLIB.  This is not
	  Darwin specific, but I believe it is generally correct.

	And, of course, distinfo must be modified.

	Here are the 5 patches:

--- arch.mk-dist	Thu Mar 20 16:34:36 2003
+++ arch.mk	Tue Jun 29 15:32:41 2004
@@ -24,6 +24,9 @@
 .elif ${OPSYS} == "SunOS"
 _PVM_OPSYS=	SUN4
 _PVM_ARCH=	SOL2	# Solaris (SunOS 5.*)
+.elif ${OPSYS} == "Darwin"
+_PVM_OPSYS=	DARWIN
+_PVM_ARCH=	# empty
 .else
 _PVM_OPSYS=	UNKNOWN
 _PVM_ARCH=	# empty
--- conf/DARWIN.def.orig	Thu Sep 27 13:56:33 2001
+++ conf/DARWIN.def	Fri Jul  2 16:33:29 2004
@@ -1,9 +1,8 @@
 ARCHCFLAGS	=	-DSOCKADHASLEN -DNOREXEC \
-	-DRSHCOMMAND=\"/usr/bin/rsh\" \
+	-DRSHCOMMAND=\"${SSH}\" \
 	-DHASSTDLIB -DNEEDMENDIAN -DHASERRORVARS \
-	-DFAKEXDRFLOAT -DSYSERRISCONST \
-	-I/System/Library/Frameworks/System.framework/Headers/bsd/sys
-	# this last -I flag needed for tracer build...
+	-DSYSERRISCONST \
+	-nostdinc -isystem /usr/include/gcc/darwin/default -isystem /usr/include
 ARCHDLIB	=
 ARCHDOBJ	=
 ARCHLIB		=	
--- tracer/tracer.h.orig	Fri May 11 15:19:43 2001
+++ tracer/tracer.h	Tue Jun 29 14:23:21 2004
@@ -40,8 +40,12 @@
 #include "pvmwin.h"
 #include <time.h>
 #endif
+#ifdef HASSTDLIB
+#include <stdlib.h>
+#else
 #ifndef IMA_MACOSX
 #include <malloc.h>
+#endif
 #endif
 #include <signal.h>
 #include <ctype.h>
--- tracer/trclib.h.orig	Fri May 11 15:19:43 2001
+++ tracer/trclib.h	Tue Jun 29 14:31:42 2004
@@ -34,8 +34,12 @@
 #include "pvmwin.h"
 #endif
 #include <time.h>
+#ifdef HASSTDLIB
+#include <stdlib.h>
+#else
 #ifndef IMA_MACOSX
 #include <malloc.h>
+#endif
 #endif


--- tracer/trcsort.c.orig	Fri May 11 15:19:44 2001
+++ tracer/trcsort.c	Tue Jun 29 14:41:00 2004
@@ -31,8 +31,12 @@
 #include <sys/types.h>
 #include <sys/stat.h>

+#ifdef HASSTDLIB
+#include <stdlib.h>
+#else
 #ifndef IMA_MACOSX
 #include <malloc.h>
+#endif
 #endif

 #ifdef  SYSVSTR
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->darwin-pkg-people 
Responsible-Changed-By: recht 
Responsible-Changed-When: Fri Jul 2 23:33:31 UTC 2004 
Responsible-Changed-Why:  
over to darwin-pkg-people 

From: Jim Bernard <jbernard@mines.edu>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: Re: pkg/26146: Changes to make parallel/pvm3 build under Darwin
Date: Thu, 8 Jul 2004 16:58:53 -0600

 It turns out that, in addition to the patches needed to make pvm3 build,
 one more thing is necessary to make it usable: ranlib.  Under Mac OS X,
 the timestamp on the library index must be newer than the creation time
 of the file, so when the libraries are installed, the copies are not
 usable for linking.  This could be fixed by copying them with the
 creation time preserved, or by running ranlib on them after they are
 installed.  I suspect this is not an issue for binary packages, but I
 haven't checked.

 Here's a patch to the pkg Makefile that does ranlib on the installed
 libraries:

 --- Makefile-dist	Mon May 31 21:09:09 2004
 +++ Makefile	Thu Jul  8 11:53:53 2004
 @@ -67,6 +67,9 @@
  	${INSTALL_PROGRAM} ${WRKSRC}/lib/${PVM_ARCH}/pvm*		\
  		${PVM_DIR}/lib/${PVM_ARCH}
  	${INSTALL_DATA} ${WRKSRC}/lib/${PVM_ARCH}/*.a ${PVM_DIR}/lib/${PVM_ARCH}
 +.if ${OPSYS} == "Darwin"
 +	ranlib ${PVM_DIR}/lib/${PVM_ARCH}/*.a
 +.endif
  	for f in `${LS} -1 ${WRKSRC}/lib`; do				\
  		if [ -f ${WRKSRC}/lib/$$f ]; then			\
  			${INSTALL_SCRIPT} ${WRKSRC}/lib/$$f ${PVM_DIR}/lib; \


 --Jim

From: Dan McMahill <dmcmahill@NetBSD.org>
To: jbernard@mines.edu
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26146: Changes to make parallel/pvm3 build under Darwin
Date: Thu, 15 Jul 2004 18:19:29 -0400

 > >Number:         26146
 > >Category:       pkg
 > >Synopsis:       Changes to make parallel/pvm3 build under Darwin

 > 	work/pvm3/conf/DARWIN.def: Incorporate RSHCOMMAND like the
 > 	  NetBSD .def files do.  Eliminate FAKEXDRFLOAT (no longer
 > 	  needed---this source is pretty old) and the -I flag (also
 > 	  no longer needed).  Add flags to eliminate /usr/local/include
 > 	  from the system paths searched by cpp (see PR 26143 for
 > 	  details; since aimk is used here, the change to sys.mk
 > 	  given in that PR is not sufficient to eliminate
 > 	  /usr/local/include in this build; but maybe buildlink3
 > 	  could be modified to handle it).

 I was about to make some other changes to pvm3 and wanted to get this
 PR addressed first.  So what happens if pvm3 looks in /usr/local/include?
 It is causing a problem here?

 What if you are using a different gcc, will these changes break it
 because of the -isystem /usr/include/gcc/darwin/default part?

 -Dan

 -- 

From: Jim Bernard <jbernard@mines.edu>
To: Dan McMahill <dmcmahill@NetBSD.org>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26146: Changes to make parallel/pvm3 build under Darwin
Date: Thu, 15 Jul 2004 21:41:25 -0600

 On Thu, Jul 15, 2004 at 06:19:29PM -0400, Dan McMahill wrote:
 > > >Number:         26146
 > > >Category:       pkg
 > > >Synopsis:       Changes to make parallel/pvm3 build under Darwin
 >  
 > > 	work/pvm3/conf/DARWIN.def: Incorporate RSHCOMMAND like the
 > > 	  NetBSD .def files do.  Eliminate FAKEXDRFLOAT (no longer
 > > 	  needed---this source is pretty old) and the -I flag (also
 > > 	  no longer needed).  Add flags to eliminate /usr/local/include
 > > 	  from the system paths searched by cpp (see PR 26143 for
 > > 	  details; since aimk is used here, the change to sys.mk
 > > 	  given in that PR is not sufficient to eliminate
 > > 	  /usr/local/include in this build; but maybe buildlink3
 > > 	  could be modified to handle it).
 > 
 > I was about to make some other changes to pvm3 and wanted to get this
 > PR addressed first.

   Thanks for looking at this!

 > So what happens if pvm3 looks in /usr/local/include?
 > It is causing a problem here?

   Good question.  In my particular case, IIRC, there was no specific
 trouble with pvm3 itself.  But, as you can imagine, whenever any
 source file in a pkg build includes a system header file and cpp looks
 in /usr/local/include before looking in the real system directories,
 there's potential for bad things to happen, and whether they occur
 depends on what happens to be in /usr/local/include at the time of the
 build.  So to be sure there's no possibility of breakage, we need to
 remove /usr/local/include from the list of system include directories.

   An example from the pkgsrc bootstrap problem described in 26143 is
 that the bootstrap succeeded on one system and failed on another.
 The reason turned out to be the presence of db.h from a db4 installation
 in /usr/local/include on the box where the bootstrap failed.

   One of the changes I suggested in 26143 was to add the relevant
 flags in sys.mk, but since pvm3 uses aimk instead of bmake to build,
 if we want to be sure to exclude /usr/local/include, it's not enough
 to rely on the change to sys.mk; the change has to be made locally.
 Perhaps more precisely, CPPFLAGS is the appropriate place to add the
 flags in sys.mk for bmake, but for pvm3/aimk, it's in ARCHCFLAGS,
 which gets added to CFLAGS (and CPPFLAGS is not used, so even if
 bmake passes that to aimk in the environment, it doesn't help).

   I have a suspicion that buildlink3 may really be the right tool
 to accomplish all this, but I'm not familiar enough with it to be
 sure.

 > What if you are using a different gcc, will these changes break it
 > because of the -isystem /usr/include/gcc/darwin/default part?

   I think they would break it, yes.  Unfortunately, there doesn't seem
 to be any way to delete a directory from the list of system include
 directories.  It's apparently only possible to delete all of them
 and to add new ones to the list.

   I wonder if it's perhaps best just to declare Apple's compiler broken
 and make all of pkgsrc require lang/gccwhatever.  But are there also
 important beneficial features in Apple's compiler?

 --Jim

From: Dan McMahill <dmcmahill@NetBSD.org>
To: Jim Bernard <jbernard@mines.edu>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26146: Changes to make parallel/pvm3 build under Darwin
Date: Fri, 16 Jul 2004 08:46:56 -0400

 >   Good question.  In my particular case, IIRC, there was no specific
 > trouble with pvm3 itself.  But, as you can imagine, whenever any
 > source file in a pkg build includes a system header file and cpp looks
 > in /usr/local/include before looking in the real system directories,
 > there's potential for bad things to happen, and whether they occur
 > depends on what happens to be in /usr/local/include at the time of the
 > build.  So to be sure there's no possibility of breakage, we need to
 > remove /usr/local/include from the list of system include directories.


 >   One of the changes I suggested in 26143 was to add the relevant
 > flags in sys.mk, but since pvm3 uses aimk instead of bmake to build,
 > if we want to be sure to exclude /usr/local/include, it's not enough
 > to rely on the change to sys.mk; the change has to be made locally.
 > Perhaps more precisely, CPPFLAGS is the appropriate place to add the
 > flags in sys.mk for bmake, but for pvm3/aimk, it's in ARCHCFLAGS,
 > which gets added to CFLAGS (and CPPFLAGS is not used, so even if
 > bmake passes that to aimk in the environment, it doesn't help).
 > 
 >   I have a suspicion that buildlink3 may really be the right tool
 > to accomplish all this, but I'm not familiar enough with it to be
 > sure.

 buildlink3 can probably be used within pkgsrc to fix up the include
 path.  I guess the issue is that some users may use aimk to build
 a program which uses pvm3 and that program may reside outside of pkgsrc.
 In this case bl3 is not around.  Of course I really dislike aimk
 and its possible no one is doing that anyway.  It turns out that the
 two packages within pkgsrc which depend on pvm do not use aimk and
 hence end up ignoring $PVM_ARCH.def anyway (which I suppose may be
 questionable).

 > > What if you are using a different gcc, will these changes break it
 > > because of the -isystem /usr/include/gcc/darwin/default part?
 > 
 >   I think they would break it, yes.  Unfortunately, there doesn't seem
 > to be any way to delete a directory from the list of system include
 > directories.  It's apparently only possible to delete all of them
 > and to add new ones to the list.
 > 
 >   I wonder if it's perhaps best just to declare Apple's compiler broken
 > and make all of pkgsrc require lang/gccwhatever.  But are there also
 > important beneficial features in Apple's compiler?

 Are they using gcc or something else?  Have people complained to apple
 about including /usr/local/include by default and in fact including it
 before the system libraries?

 -- 

From: Jim Bernard <jbernard@mines.edu>
To: Dan McMahill <dmcmahill@NetBSD.org>
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: pkg/26146: Changes to make parallel/pvm3 build under Darwin
Date: Fri, 16 Jul 2004 08:23:36 -0600

 On Fri, Jul 16, 2004 at 08:46:56AM -0400, Dan McMahill wrote:
 >
 > buildlink3 can probably be used within pkgsrc to fix up the include
 > path.  I guess the issue is that some users may use aimk to build
 > a program which uses pvm3 and that program may reside outside of pkgsrc.

   I'd say that's outside the "responsibility" of pkgsrc.  This problem
 with the Apple compiler could cause trouble to anyone building anything,
 regardless of whether pkgsrc is involved.  Maybe we should document it
 in a README somewhere, so Darwin users of pkgsrc will at least be aware
 of the potential for lossage.

 > >   I wonder if it's perhaps best just to declare Apple's compiler broken
 > > and make all of pkgsrc require lang/gccwhatever.  But are there also
 > > important beneficial features in Apple's compiler?
 >
 > Are they using gcc or something else?  Have people complained to apple
 > about including /usr/local/include by default and in fact including it
 > before the system libraries?

   It is gcc (3.3, IIRC), but with some Apple-specific additions (clearly
 marked in the gcc man page), and with Apple's choice of "system" include 
 directories.  I don't know if anyone has complained or not (I'm not at
 all attuned to the Apple user community), but I think someone should :-).

 --Jim
State-Changed-From-To: open->closed 
State-Changed-By: dmcmahill 
State-Changed-When: Sun Jul 18 18:05:34 UTC 2004 
State-Changed-Why:  
patches (except the compiler include path part) applied. 
thanks. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.