Subject: pkg/36807: net/irrtoolset-nox11 fails to build on netbsd-4.0beta2 (and -current too)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Yakovetsky Vladimir <yx@x.ua>
List: pkgsrc-bugs
Date: 08/20/2007 08:40:00
>Number:         36807
>Category:       pkg
>Synopsis:       net/irrtoolset-nox11 fails to build on netbsd 4.0beta2 (and -current too)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 20 08:40:00 +0000 2007
>Originator:     Yakovetsky Vladimir
>Release:        NetBSD 4.0_BETA2
>Organization:
>Environment:
System: NetBSD darg.x.ua 4.0_BETA2 NetBSD 4.0_BETA2 (darg-1.799.2.7-mp-1.8.8.1) #1: Tue Jul 24 16:42:00 EEST 2007 yx@darg.x.ua:/sys/arch/i386/compile/darg.mp i386
Architecture: i386
Machine: i386
>Description:
net/irrtoolset-nox11 fails to build on netbsd 4.0beta2 (and -current too)

>How-To-Repeat:
% uname -sr
NetBSD 4.0_BETA2

% cd /usr/pkgsrc/net/irrtoolset-nox11

% make ACCEPTABLE_LICENSES=no-commercial-use update
...
Compiling: rpsl.l
flex -P`basename rpsl.l .l` rpsl.l
mv lex.`basename rpsl.l .l`.c `basename rpsl.l`.cc
Compiling: rpsl.l.cc
c++ -c  -O2 -march=pentium3 -mfpmath=sse -msse -finline-functions -fomit-frame-pointer -ffast-math -DHAVE_CONFIG_H -I. -I. -I.. -I../src -I../../Core  rpsl.l.cc
rpsl.l: In function 'void rpsl_scan_object(Object*)':
rpsl.l:754: error: call of overloaded 'rpsl_scan_bytes(char*&, long unsigned int&)' is ambiguous
lex.rpsl.c:2774: note: candidates are: yy_buffer_state* rpsl_scan_bytes(const char*, yy_size_t)
lex.rpsl.c:2808: note:                 yy_buffer_state* rpsl_scan_bytes(const char*, int)
gmake[4]: *** [rpsl.l.o] Error 1
...
c++ -O2 -march=pentium3 -mfpmath=sse -msse -finline-functions -fomit-frame-pointer -ffast-math -o rpslcheck rpslcheck.o -L../irr -L../rpsl -L../Core -L../gnug++ -L../util -lirr -lrpsl -lCore -lgnug++ -lutil 
ld: cannot find -lrpsl
gmake[2]: *** [rpslcheck] Error 1
...
c++ -O2 -march=pentium3 -mfpmath=sse -msse -finline-functions -fomit-frame-pointer -ffast-math -o peval peval.o   -L../normalform -L../irr -L../re2dfa -L../rpsl -L../Core -L../gnug++ -L../util -lnormalform -lirr -lre2dfa -lrpsl -lCore -lgnug++ -lutil  -ltermcap 
ld: cannot find -lrpsl
gmake[2]: *** [peval] Error 1
...
c++ -O2 -march=pentium3 -mfpmath=sse -msse -finline-functions -fomit-frame-pointer -ffast-math -o RtConfig RtConfig.o  command.y.o  command.l.o  f_cisco.o  f_junos.o -L../normalform -L../irr -L../re2dfa -L../rpsl -L../Core -L../gnug++ -L../util -lnormalform -lirr -lre2dfa -lrpsl -lCore -lgnug++ -lutil 
ld: cannot find -lrpsl
gmake[2]: *** [RtConfig] Error 1
...
===> Installing for IRRToolSet-4.8.5nb1
=> Creating installation directories
gmake[1]: Entering directory `/usr/obj/net/irrtoolset-nox11/work/IRRToolSet-4.8.5/src'
for i in rpslcheck peval RtConfig ; do /usr/bin/install -c -s -o root -g wheel -m 555 $i/$i /usr/pkg/bin; done
install: rpslcheck/rpslcheck: stat: No such file or directory
install: peval/peval: stat: No such file or directory
install: RtConfig/RtConfig: stat: No such file or directory
gmake[1]: *** [install] Error 1
gmake[1]: Leaving directory `/usr/obj/net/irrtoolset-nox11/work/IRRToolSet-4.8.5/src'
gmake: *** [install] Error 2
*** Error code 2

Stop.
make: stopped in /usr/pkgsrc/net/irrtoolset-nox11
*** Error code 1



>Fix:
	patches(-ct,-cu) below:

:r net/irrtoolset-nox11/patches/patch-ct
--- src/Core/util/Buffer.hh.~1~
+++ src/Core/util/Buffer.hh
@@ -41,6 +41,14 @@
 #endif // HAVE_MALLOC_H
 }
 
+#include "config.h"
+#ifdef STDC_HEADERS
+#include <stddef.h>
+#define BUFFER_SIZE_T	size_t
+#else
+#define BUFFER_SIZE_T	unsigned long
+#endif
+
 #include "util/List.hh"
 
 const int BufferExtendIncrement	= 4 * 1024;
@@ -66,7 +74,7 @@
        callerAllocated = false;
        append(b.contents, b.size);
     }
-    Buffer(char *cont, unsigned long sz) : ListNode() {
+    Buffer(char *cont, BUFFER_SIZE_T sz) : ListNode() {
         contents = cont;
         capacity = sz;
         size = sz;
@@ -82,7 +90,7 @@
     }
 
     // Initiated a callee allocated buffer
-    Buffer(unsigned long sz) : ListNode() {
+    Buffer(BUFFER_SIZE_T sz) : ListNode() {
         contents = (char *) malloc(sz);
 	contents[0] = '\0';
         capacity = sz;
@@ -107,16 +115,16 @@
     uncompress();
 
     // increase capacity of Buffer, by at least minExtend
-    void extend(unsigned long minExtend = BufferExtendIncrement);
-    void append(const char *buf, unsigned long sz);
+    void extend(BUFFER_SIZE_T minExtend = BufferExtendIncrement);
+    void append(const char *buf, BUFFER_SIZE_T sz);
     void append(const char *str) {
        append(str, strlen(str));
     }
     void append(Buffer &buf);
     void appendf(const char *format, ...);
    // remove sz bytes at atOffset, does not do a free/realloc/malloc
-   void flush(unsigned long sz, unsigned long atOffset = 0);
-   void insert(Buffer &buf, unsigned long atOffset = 0);
+   void flush(BUFFER_SIZE_T sz, BUFFER_SIZE_T atOffset = 0);
+   void insert(Buffer &buf, BUFFER_SIZE_T atOffset = 0);
    // destroy the contents
    void destroy() {
       if (contents && ! callerAllocated)
@@ -141,7 +149,7 @@
    bool isFull() {
       return capacity && capacity == size;
    }
-   bool hasSpace(unsigned long sz) {
+   bool hasSpace(BUFFER_SIZE_T sz) {
       return size + sz <= capacity;
    }
    bool operator==(const Buffer &b) const {
@@ -151,7 +159,7 @@
       return ! (*this == b);
    }
    bool operator==(const char *cont) const {
-      unsigned long len = strlen(cont);
+      BUFFER_SIZE_T len = strlen(cont);
       return size == len && !strncasecmp(contents, cont, len);
    }
    bool operator!=(const char *cont) const {
@@ -161,7 +169,7 @@
    char *getContents(void) const {
      return contents;
    }
-   unsigned long getSize(void) const {
+   BUFFER_SIZE_T getSize(void) const {
      return size;
    }
    void zeroFill(); 
@@ -172,9 +180,9 @@
    char *makeString() const;
 public:
     char*		contents;
-    unsigned long	capacity;
-    unsigned long	size;
-    unsigned long	offset;
+    BUFFER_SIZE_T	capacity;
+    BUFFER_SIZE_T	size;
+    BUFFER_SIZE_T	offset;
     bool		callerAllocated;
 };

:r net/irrtoolset-nox11/patches/patch-cu
--- src/Core/util/Buffer.cc.~1~
+++ src/Core/util/Buffer.cc
@@ -86,7 +86,7 @@
     Buffer*			nbuf;
 
     // Need at most 1.1 * length for the decompressed buffer
-    nbuf = new Buffer((unsigned long) ((1.1 * size) + 12));
+    nbuf = new Buffer((BUFFER_SIZE_T) ((1.1 * size) + 12));
 
     // Compress the incoming data
     cp.zalloc = (alloc_func) mymalloc;
@@ -176,7 +176,7 @@
 #endif
 }
 
-void Buffer::extend(unsigned long minExtend) {
+void Buffer::extend(BUFFER_SIZE_T minExtend) {
    assert(!callerAllocated);	// !!!
    // using deprecated g++ only operators is not that portable,
    // use ordinary trigraph instead
@@ -186,7 +186,7 @@
 }
 
 void 
-Buffer::append(const char *buf, unsigned long sz)
+Buffer::append(const char *buf, BUFFER_SIZE_T sz)
 {
    if (size + sz + 1 > capacity)
       extend(sz);
@@ -218,7 +218,7 @@
    size += buf.size;
 }
 
-void Buffer::insert(Buffer &buf, unsigned long atOffset) {
+void Buffer::insert(Buffer &buf, BUFFER_SIZE_T atOffset) {
    if (size + buf.size > capacity)
       extend(buf.size);
    memmove(contents + atOffset + buf.size, 
@@ -228,7 +228,7 @@
    size += buf.size;
 }
 
-void Buffer::flush(unsigned long sz, unsigned long atOffset) {
+void Buffer::flush(BUFFER_SIZE_T sz, BUFFER_SIZE_T atOffset) {
    if (sz == 0 || size == 0)
       return;