Subject: pkg/23368: abiword patch-ac breaks build with gcc 3.3.1 on Linux
To: None <gnats-bugs@gnats.netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 11/04/2003 08:38:50
>Number:         23368
>Category:       pkg
>Synopsis:       abiword patch-ac breaks build with gcc 3.3.1 on Linux
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 04 16:39:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6.1_STABLE
>Organization:
http://bsd.reedmedia.net/
>Environment:
>Description:
pkgsrc/editors/abiword/patches/patch-ac CVS log says "Let this
compile with NetBSD-current/gcc-3.3.1."

But it breaks on Linux, glibc 2.2.5 with g++ (GCC) 3.3.1. (I don't think
this is related, but I do not use libiconv, because it is included in
glibc. I have another patch for that.)

 ut_iconv.cpp: In function `size_t UT_iconv(void*, const char**, size_t*,
    char**, size_t*)':
 ut_iconv.cpp:163: error: invalid conversion from `const char**' to `char**'
 make[4]: *** [ut_iconv.o] Error 1
 make[4]: Leaving directory
 `/tmp/pkgsrc/editors/abiword/work.antelope/abiword-1.
 0.5/abi/src/af/util/xp'

>How-To-Repeat:
>Fix:
The 1.39 revision (and newer revisions) at
http://www.abisource.com/lxr/source/abi/src/af/util/xp/ut_iconv.cpp
has:

 ICONV_CONST char ** buf = const_cast<ICONV_CONST char**>(inbuf);
 return iconv( cd, buf, inbytesleft, outbuf, outbytesleft );

So using that abisource fix above, the following patch-ac works
for me under Linux with gcc 3.3.1 and under NetBSD 1.6.1_STABLE
with g++ 2.95.3.

--- src/af/util/xp/ut_iconv.cpp.orig	2002-04-24 12:49:23.000000000 -0700
+++ src/af/util/xp/ut_iconv.cpp	2003-11-01 08:38:54.000000000 -0800
@@ -159,7 +159,7 @@
   if ( !UT_iconv_isValid ( cd ) )
     return (size_t)-1;

-  ICONV_CONST char ** buf = (ICONV_CONST char**)(inbuf);
+  ICONV_CONST char ** buf = const_cast<ICONV_CONST char**>(inbuf);
   return iconv( cd, buf, inbytesleft, outbuf, outbytesleft );
 }

I sent this PR, because I didn't test under NetBSD-current.
I don't want to break someone elses package without permission first.
A few days ago, I gave this information to maintainer and
to developer who did the last patch-ac.
>Release-Note:
>Audit-Trail:
>Unformatted: