From kutulu@kutulu.org  Wed May 11 20:59:54 2005
Return-Path: <kutulu@kutulu.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B585016A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 11 May 2005 20:59:54 +0000 (GMT)
Received: from basement.kutulu.org (211.215.33.65.cfl.res.rr.com [65.33.215.211])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 47ED443D31
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 11 May 2005 20:59:54 +0000 (GMT)
	(envelope-from kutulu@kutulu.org)
Received: from wombat.jungle (wombat.jungle [192.168.69.3])
	by basement.kutulu.org (Postfix) with ESMTP id 57ED73B;
	Wed, 11 May 2005 16:59:53 -0400 (EDT)
Received: by wombat.jungle (Postfix, from userid 1001)
	id 98E119581C; Wed, 11 May 2005 17:01:40 -0400 (EDT)
Message-Id: <20050511210140.98E119581C@wombat.jungle>
Date: Wed, 11 May 2005 17:01:40 -0400 (EDT)
From: Michael Edenfield <kutulu@kutulu.org>
Reply-To: Michael Edenfield <kutulu@kutulu.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: matthias.andree@gmx.de
Subject: db43 does not build (with gcc4.0?)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         80916
>Category:       ports
>Synopsis:       db43 does not build (with gcc4.0?)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 11 21:00:21 GMT 2005
>Closed-Date:    Fri Jul 29 10:45:28 GMT 2005
>Last-Modified:  Mon Aug  1 17:40:20 GMT 2005
>Originator:     Michael Edenfield
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
FreeBSD wombat.jungle 6.0-CURRENT FreeBSD 6.0-CURRENT #13: Tue Mar  1 17:22:27 EST 2005     root@wombat.jungle:/usr/obj/usr/src/sys/WOMBAT  i386

>Description:

I have been running a machine with gcc40 as the system compiler and this is one of the ports that doesn't compile.  I don't appear to have this problem on systems using the base gcc as the system compiler.  The issue appears to be a change in storage type in a single function.

However, the patch I generated cannot run from the normal patch target in ports Makefiles, since the file that needs to be patched is actually generated during the config.  Hopefully someone better versed with the db43 port can do this properly.

>How-To-Repeat:
In /usr/ports/databases/db43: 

CC=/usr/local/bin/gcc40 make
>Fix:

--- build_unix/db_server.h.old  Wed May 11 16:38:24 2005
+++ build_unix/db_server.h      Wed May 11 16:41:18 2005
@@ -1010,7 +1010,7 @@
 #define        DB_RPC_SERVERVERS ((unsigned long)(4003))
 
 #if defined(__STDC__) || defined(__cplusplus)
-extern  void db_rpc_serverprog_4003(struct svc_req *rqstp, register SVCXPRT *transp);
+static void db_rpc_serverprog_4003(struct svc_req *rqstp, register SVCXPRT *transp);
 #define        __DB_env_get_cachesize ((unsigned long)(1))
 extern  __env_get_cachesize_reply * __db_env_get_cachesize_4003(__env_get_cachesize_msg *, CLIENT *);
 extern  __env_get_cachesize_reply * __db_env_get_cachesize_4003_svc(__env_get_cachesize_msg *, struct svc_req *);


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: vs 
State-Changed-When: Thu May 12 06:59:55 GMT 2005 
State-Changed-Why:  
Waiting for maintainer feedback 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80916 

From: Matthias Andree <matthias.andree@gmx.de>
To: bug-followup@FreeBSD.org, kutulu@kutulu.org
Cc:  
Subject: Re: ports/80916: db43 does not build (with gcc4.0?)
Date: Wed, 27 Jul 2005 18:28:05 +0200

 I've tried to reproduce this on FreeBSD 4.11-RELEASE-p11 with
 gcc-4.0.0_20041226 (FreeBSD 4.11 package), but failed.
 
 make USE_GCC=4.0
 
 has apparently worked for me. Please try if "make USE_GCC=4.0" works for
 you and follow up with what you've found.
 
 -- 
 Matthias Andree

From: Matthias Andree <matthias.andree@gmx.de>
To: bug-followup@FreeBSD.org, kutulu@kutulu.org
Cc: vs@freebsd.org
Subject: Re: ports/80916: db43 does not build (with gcc4.0?)
Date: Thu, 28 Jul 2005 23:26:51 +0200

 Well, I was able to reproduce the problem on FreeBSD 5.4-mumble with gcc
 4.0.2 as of July 2005, and the patch below works for me.
 
 I don't think we should bump the PORTREVISION as this is a build-time
 only problem - either people can compile this, then they don't need an
 update of the port, or they cannot compile this, then they will be
 rebuilding even without PORTREVISION bumped.
 
 --- a/ports/databases/db43/Makefile	Sat May  7 20:26:05 2005
 +++ b/ports/databases/db43/Makefile	Thu Jul 28 22:55:44 2005
 @@ -48,6 +48,9 @@
  pre-configure:
  	${CHMOD} u+w ${WRKSRC}/../dist/configure
  
 +post-configure:
 +	@${REINPLACE_CMD} -e '/^extern  void db_rpc_serverprog/ d;' ${WRKSRC}/db_server.h
 +
  post-install:
  .for i in libdb libdb_cxx
  	${LN} -s -f ${PORTNAME}/${i}-${BDBVER}.so.0 ${PREFIX}/lib
 
 -- 
 Matthias Andree

From: Volker Stolz <vs@FreeBSD.org>
To: Matthias Andree <matthias.andree@gmx.de>
Cc: bug-followup@FreeBSD.org, kutulu@kutulu.org
Subject: Re: ports/80916: db43 does not build (with gcc4.0?)
Date: Fri, 29 Jul 2005 09:37:06 +0200

 Am 28. Jul 2005 um 23:26 CEST schrieb Matthias Andree:
 > Well, I was able to reproduce the problem on FreeBSD 5.4-mumble with gcc
 > 4.0.2 as of July 2005, and the patch below works for me.
 >  
 > +post-configure:
 > +	@${REINPLACE_CMD} -e '/^extern  void db_rpc_serverprog/ d;' ${WRKSRC}/db_server.h
 > +
 
 Shouldn't this better be a patch? I hate digging through REINPLACE_CMDs
 on updates only to find out that they're basically doing nothing on
 future updates. Patches fail more noisily and point you to the problem.
 
 Volker
 -- 
 http://www-i2.informatik.rwth-aachen.de/stolz/ *** PGP *** S/MIME
 It's a million to one chance, but it just might work.

From: Matthias Andree <matthias.andree@gmx.de>
To: Volker Stolz <vs@FreeBSD.org>
Cc: Matthias Andree <matthias.andree@gmx.de>, bug-followup@FreeBSD.org,
	kutulu@kutulu.org
Subject: Re: ports/80916: db43 does not build (with gcc4.0?)
Date: Fri, 29 Jul 2005 10:27:03 +0200

 On Fri, 29 Jul 2005, Volker Stolz wrote:
 
 > > +post-configure:
 > > +	@${REINPLACE_CMD} -e '/^extern  void db_rpc_serverprog/ d;' ${WRKSRC}/db_server.h
 > > +
 > 
 > Shouldn't this better be a patch? I hate digging through REINPLACE_CMDs
 > on updates only to find out that they're basically doing nothing on
 > future updates. Patches fail more noisily and point you to the problem.
 
 The requisite is that this runs in post-configure or pre-build, as the
 files that need patching are generated as late as in do-configure, as
 Michael already stated in his original report. rpcgen -C is used to
 build - among others - db_server.h from ../rpc_server/db_server.x, and
 is called from ./configure.
 
 I have filed a support request with SleepyCat, in their first response,
 they said they found a bug in GCC 4.0.0 or 4.0.1 that triggered when
 building the Java API, which might also be affecting the RPC server.
 
 It might also be a bug with "rpcgen" on FreeBSD, as the SUSE Linux 9.3
 rpcgen does not create the conflicting db_server.h line, whereas its
 documentation warns:
 
    "Name clashes can occur when using program definitions, since the appar-
     ent  scoping  does  not  really apply.  Most of these can be avoided by
     giving unique names for programs, versions, procedures and types."
    (Linux rpcgen(1) manual page)
 
 If rpcgen generates an extern declaration for a static function, this
 looks like an rpcgen bug to me. So perhaps this should spawn a problem
 report for bin and one for ports/lang/gcc40 each.
 
 Also, GCC 4.0.1+ is apparently overzealous by making the error shown
 below an error, I see no requirement for this in "The C Programming
 Language", appendix A, and no other compiler I have access to, flags an
 error, even with "strict" settings. SleepyCat might have a point here.
 
 If someone knows a reference that requires a compiler diagnostic aka
 error, please follow up.
 
 ### db_server.h ###
 
 extern  void db_rpc_serverprog_4003(struct svc_req *rqstp, register SVCXPRT *transp);
 
 ### db_server_svc.c ###
 
 static void
 db_rpc_serverprog_4003(struct svc_req *rqstp, register SVCXPRT *transp)
 {
 ...
 
 ### GCC errors ###
 
 db_server_svc.c:30: error: static declaration of 'db_rpc_serverprog_4003' follows non-static declaration
 db_server.h:1013: error: previous declaration of 'db_rpc_serverprog_4003' was here
 
 -- 
 Matthias Andree
State-Changed-From-To: feedback->closed 
State-Changed-By: vs 
State-Changed-When: Fri Jul 29 10:45:10 GMT 2005 
State-Changed-Why:  
Fixed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80916 

From: Mike Edenfield <kutulu@kutulu.org>
To: bug-followup@FreeBSD.org,  kutulu@kutulu.org
Cc:  
Subject: Re: ports/80916: db43 does not build (with gcc4.0?)
Date: Mon, 01 Aug 2005 13:32:22 -0400

 I know this PR is closed but I wanted to make sure this got into the 
 audit trail:
 
 The bug here is actually an rpcgen bug from FreeBSD 5.x and up; the main 
 RPC program function is always emitted 'static' but the header file 
 declares all functions, including that one, as 'extern'.  This changed 
 between 4.x and 5.x -- previously the 'extern' declaractor was not 
 emitted at all.
 
 I've submitted a bug report for rpcgen; I don't know if that means we 
 can remove this patch once rpcgen is fixed, since it has been "broken" 
 since early in 5.x.
 
 --Mike
>Unformatted:
