Subject: pkg/33764: net/tinyfugue build failure with GCC4 (MacOS X)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jdbaker@mylinuxisp.com>
List: pkgsrc-bugs
Date: 06/19/2006 02:40:00
>Number:         33764
>Category:       pkg
>Synopsis:       net/tinyfugue build failure with GCC4 (MacOS X)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 19 02:40:00 +0000 2006
>Originator:     John D. Baker
>Release:        pkgsrc-current, MacOS X 10.4.6
>Organization:
>Environment:
Darwin bwg3.technoskunk.fur 8.6.0 Darwin Kernel Version 8.6.0: Tue Mar  7 16:58:48 PST 2006; root:xnu-792.6.70.obj~1/RELEASE_PPC Power Macintosh powerpc

>Description:
net/tinyfugue fails to build with GCC4 as follows:

[...]
gcc -pipe -O2 -I/usr/pkg/include -I/usr/include -no-cpp-precomp -I/usr/pkg/include -I/usr/include -c expr.c
In file included from expr.c:38:
history.h:34: error: array type has incomplete element type
history.h:34: error: array type has incomplete element type
*** Error code 1

Stop.
bmake: stopped in /Volumes/NetBSD/tmp/pkgsrc/net/tinyfugue/work/tf-40s1/src
[...]
>How-To-Repeat:
attempt to build net/tinyfugue on any system using GCC4
>Fix:
GCC4 is much stricter about structure definitions.  The local include
file contains references to a 'struct History', but does not contain
the structure definition itself.

Instead, the structure definition is found in 'history.c', which is
a questionable practice at best and which GCC4 treats as an egregious
error.

The following patches, move the 'struct History' definition out
of 'history.c' and into 'history.h' where it belongs.  With this
patch in place, net/tinyfugue builds/installs/runs properly.

--- work/tf-40s1/src/history.c.orig     2006-06-18 21:08:21.000000000 -0500
+++ work/tf-40s1/src/history.c  2006-06-18 21:08:40.000000000 -0500
@@ -38,18 +38,6 @@
 #define LOCALSIZE      100     /* local history size */
 #define INPUTSIZE      100     /* command history buffer size */
 
-typedef struct History {       /* circular list of Alines, and logfile */
-    struct Aline **alines;
-    int size;                  /* actual number of lines currently saved */
-    int maxsize;               /* maximum number of lines that can be saved */
-    int first;                 /* position of first line in circular array */
-    int last;                  /* position of last line in circular array */
-    int index;                 /* current recall position */
-    int total;                 /* total number of lines ever saved */
-    TFILE *logfile;
-    CONST char *logname;
-} History;
-
 #define empty(hist) (!(hist)->alines || !(hist)->size)
 
 static void     FDECL(alloc_history,(History *hist, int maxsize));


--- work/tf-40s1/src/history.h.orig     2006-06-18 21:08:27.000000000 -0500
+++ work/tf-40s1/src/history.h  2006-06-18 21:08:50.000000000 -0500
@@ -12,6 +12,18 @@
 
 # ifndef NO_HISTORY
 
+typedef struct History {       /* circular list of Alines, and logfile */
+    struct Aline **alines;
+    int size;                  /* actual number of lines currently saved */
+    int maxsize;               /* maximum number of lines that can be saved */
+    int first;                 /* position of first line in circular array */
+    int last;                  /* position of last line in circular array */
+    int index;                 /* current recall position */
+    int total;                 /* total number of lines ever saved */
+    TFILE *logfile;
+    CONST char *logname;
+} History;
+
 extern void   NDECL(init_histories);
 extern struct History *FDECL(init_history,(struct History *hist, int maxsize));
 extern void   FDECL(free_history,(struct History *hist));