From nobody@FreeBSD.org  Thu Oct 17 11:15:03 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A4D0037B401
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Oct 2002 11:15:03 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3FA8A43E88
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Oct 2002 11:15:03 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g9HIF37R004697
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Oct 2002 11:15:03 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g9HIF3oa004696;
	Thu, 17 Oct 2002 11:15:03 -0700 (PDT)
Message-Id: <200210171815.g9HIF3oa004696@www.freebsd.org>
Date: Thu, 17 Oct 2002 11:15:03 -0700 (PDT)
From: Liu Kang <lazykang@hotmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: coda can not be compiled, ports's error or sys/types.h 's problem?
X-Send-Pr-Version: www-1.0

>Number:         44176
>Category:       misc
>Synopsis:       coda can not be compiled, ports's error or sys/types.h 's problem?
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 17 11:20:01 PDT 2002
>Closed-Date:    Wed Mar 05 01:47:38 PST 2003
>Last-Modified:  Wed Mar 05 01:47:38 PST 2003
>Originator:     Liu Kang
>Release:        4.7 & 5
>Organization:
Beijing Polytechnic Univerisity
>Environment:
FreeBSD ftp.bjpu.edu.cn 4.7-STABLE FreeBSD 4.7-STABLE #19: Wed Oct 16 04:30:06 CST 2002     root@ftp.bjpu.edu.cn:/usr/obj/usr/src/sys/FTP  i386      
>Description:
      when I tried to install coda from /usr/ports/net/coda5_server it said:
/usr/ports/net/coda5_server/work/coda-5.3.19/include/coda.h:130: redefinition of `int8_t'
/usr/include/sys/inttypes.h:11: `int8_t' previously declared here
/usr/ports/net/coda5_server/work/coda-5.3.19/include/coda.h:131: redefinition of `u_int8_t'
/usr/include/sys/types.h:60: `u_int8_t' previously declared here
/usr/ports/net/coda5_server/work/coda-5.3.19/include/coda.h:132: redefinition of `int16_t'
/usr/include/sys/inttypes.h:12: `int16_t' previously declared here
/usr/ports/net/coda5_server/work/coda-5.3.19/include/coda.h:133: redefinition of `u_int16_t'
/usr/include/sys/types.h:61: `u_int16_t' previously declared here
/usr/ports/net/coda5_server/work/coda-5.3.19/include/coda.h:134: redefinition of `int32_t'
/usr/include/sys/inttypes.h:13: `int32_t' previously declared here
/usr/ports/net/coda5_server/work/coda-5.3.19/include/coda.h:135: redefinition of `u_int32_t'
/usr/include/sys/types.h:62: `u_int32_t' previously declared here
gmake[2]: *** [pioctl.o] Error 1
gmake[2]: Leaving directory `/usr/ports/net/coda5_server/work/coda-5.3.19/coda-src/kerndep'
----> Error in kerndep
gmake[1]: *** [Coda] Error 1
gmake[1]: Leaving directory `/usr/ports/net/coda5_server/work/coda-5.3.19/coda-src'
----> Error in coda-src
gmake: *** [Coda] Error 1
*** Error code 2



I check the source code of coda, work/coda-5.3.19/include (line 130):
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef signed char           int8_t;
typedef unsigned char       u_int8_t;
typedef short                int16_t;
typedef unsigned short     u_int16_t;
typedef int                  int32_t;   
typedef unsigned int       u_int32_t;
#endif

after I added following lines , the compile error disappeared.
#if defined(__BSD44__)
#define __BIT_TYPES_DEFINED__
#endif

I checked the code of /usr/include/sys/types.h and NetBSD's sys/ int_types.h. 
There is a line in NetBSD's inet_types.h "#define __BIT_TYPES_DEFINED__" 
but freebsd's does not have. 
I'm not sure if it should be add into freebsd's sys/types.h
>How-To-Repeat:
      run make in /usr/ports/net/coda5_server or net/coda5_client
>Fix:
There are 2 ways to fix the problem:
I.  make a patch for coda.h in ports dir.
--- coda.h.orig Fri Oct 18 02:00:15 2002
+++ coda.h      Fri Oct 18 01:59:25 2002
@@ -67,6 +67,10 @@
 #include <sys/types.h>
 #endif 
 
+#if defined(__BSD44__)
+#define __BIT_TYPES_DEFINED__
+#endif
+
 #ifndef CODA_MAXSYMLINKS
 #define CODA_MAXSYMLINKS 10
 #endif      

II:
Add  "#define __BIT_TYPES_DEFINED__" into  sys/types.h
I'm not sure it is right or wrong.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Wed Mar 5 01:47:23 PST 2003 
State-Changed-Why:  
The coda5_server port was fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=44176 
>Unformatted:
