Subject: Re: pkg/33403: Can't build perl module written by C++
To: None <jlam@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,>
From: OBATA Akio <obata@lins.jp>
List: pkgsrc-bugs
Date: 05/05/2006 11:25:02
The following reply was made to PR pkg/33403; it has been noted by GNATS.

From: OBATA Akio <obata@lins.jp>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/33403: Can't build perl module written by C++
Date: Fri, 5 May 2006 20:23:44 +0900

 On Fri, 05 May 2006 18:33:46, Johnny C. Lam wrote:
 > Ah, I notice I made an error in my patch.  Could you please try this
 > one instead?  Just drop it into lang/perl5/patches and "make mps" to
 > regenerate the patch checksums.
 
 After add this patch, errors in perl.h has gone away.
 
 But many errors ocuured in another files.
 
 ===> Building for p5-mecab-0.91
 cp MeCab.pm blib/lib/MeCab.pm
 c++ -c  -I/usr/pkg/include  -fno-strict-aliasing -pipe -I/usr/pkg/include -O2  -I/usr/pkg/include -I/usr/include    -I/usr/pkg/include -I/usr/include    -DVERSION=\"0.91\"  -DXS_VERSION=\"0.91\" -DPIC -fPIC "-I/usr/pkg/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE"   MeCab_wrap.cxx
 MeCab_wrap.cxx:1191: error: parse error before `__attribute__'
 MeCab_wrap.cxx:1191: error: syntax error before `)' token
 MeCab_wrap.cxx:1192: error: syntax error before `*' token
 MeCab_wrap.cxx:1197: error: 'SwigPerlWrapperPtr' is used as a type, but is not
    defined as a type.
 MeCab_wrap.cxx:1778: error: parse error before `__attribute__'
 MeCab_wrap.cxx: In function `void _wrap_Path_rnode_get(...)':
 MeCab_wrap.cxx:1787: error: parse error before `if'
 MeCab_wrap.cxx:1789: error: parse error before `}' token
 MeCab_wrap.cxx:1790: error: ISO C++ forbids declaration of `res1' with no type
 MeCab_wrap.cxx:1790: error: redefinition of `int res1'
 MeCab_wrap.cxx:1783: error: `int res1' previously defined here
 MeCab_wrap.cxx:1791: error: parse error before `if'
 MeCab_wrap.cxx:1794: error: ISO C++ forbids declaration of `arg1' with no type
 MeCab_wrap.cxx:1794: error: invalid conversion from `mecab_path_t*' to `int'
 MeCab_wrap.cxx:1795: error: ISO C++ forbids declaration of `result' with no
    type
 MeCab_wrap.cxx:1795: error: conflicting types for `int result'
 MeCab_wrap.cxx:1781: error: previous declaration as `mecab_node_t*result'
 MeCab_wrap.cxx:1795: error: base operand of `->' is not a pointer
 MeCab_wrap.cxx:1797: error: ISO C++ forbids declaration of `
    Perl_Tstack_base_ptr' with no type
 MeCab_wrap.cxx:1797: error: variable-size type declared outside of any function
 MeCab_wrap.cxx:1797: error: `int (*Perl_Tstack_base_ptr)[2]' redeclared as
    different kind of symbol
 /pkg_comp/obj/pkgsrc/wip/p5-mecab/default/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/thrdvar.h:42: error: previous
    declaration of `SV*** Perl_Tstack_base_ptr(PerlInterpreter*)'
 MeCab_wrap.cxx:1797: error: cannot convert `PerlInterpreter*' to `int (*)[2]'
    in initialization
 MeCab_wrap.cxx:1797: error: invalid static_cast from type `int' to type `const
    void*'
 MeCab_wrap.cxx:1797: error: assignment (not initialization) in declaration
 MeCab_wrap.cxx:1797: error: syntax error before `++' token
 
 (...... many, many errors ........)
 
 {standard input}:6321: Error: symbol `_ZZ18_swig_create_magiczE19SWIG_TypeClientData' is already defined
 {standard input}:6328: Error: symbol `_ZZ18_swig_create_magiczE19Perl_sv_setsv_flags' is already defined
 *** Error code 1
 
 Stop.
 make: stopped in /pkg_comp/obj/pkgsrc/wip/p5-mecab/default/mecab-perl-0.91
 *** Error code 1
 
 Stop.
 make: stopped in /usr/pkgsrc/wip/p5-mecab
 ===>
 ===> There was an error during the ``build'' phase.
 ===> Please investigate the following for more information:
 ===>      * log of the build
 ===>      * /pkg_comp/obj/pkgsrc/wip/p5-mecab/default/.work.log
 ===>
 *** Error code 1
 
 Stop.
 make: stopped in /usr/pkgsrc/wip/p5-mecab
 
 
 MeCab_wrap.cxx:
   1191  typedef XS(SwigPerlWrapper);
   1192  typedef SwigPerlWrapper *SwigPerlWrapperPtr;
   1193
   1194  /* Structure for command table */
   1195  typedef struct {
   1196    const char         *name;
   1197    SwigPerlWrapperPtr  wrapper;
   1198  } swig_command_info;
 
   1775  #ifdef __cplusplus
   1776  extern "C" {
   1777  #endif
   1778  XS(_wrap_Path_rnode_get) {
   1779    {
   1780      mecab_path_t *arg1 = (mecab_path_t *) 0 ;
   1781      mecab_node_t *result = 0 ;
   1782      void *argp1 = 0 ;
   1783      int res1 = 0 ;
   1784      int argvi = 0;
   1785      dXSARGS;
   1786
   1787      if ((items < 1) || (items > 1)) {
   1788        SWIG_croak("Usage: Path_rnode_get(self);");
   1789      }
   1790      res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_mecab_path_t, 0 |  0 );
   1791      if (!SWIG_IsOK(res1)) {
   1792        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Path_rnode_get" "', argument " "1"" of type '" "mecab_path_t *""'");
   1793      }
   1794      arg1 = reinterpret_cast<mecab_path_t * >(argp1);
   1795      result = (mecab_node_t *) ((arg1)->rnode);
   1796
   1797      ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_mecab_node_t, 0 | SWIG_SHADOW); argvi++ ;
   1798
   1799      XSRETURN(argvi);
   1800    fail:
   1801
   1802      SWIG_croak_null();
   1803    }
   1804  }
 
 If fllowing patch was applied, build OK.
 
 --- XSUB.h.orig 2006-04-13 10:28:48.000000000 +0900
 +++ XSUB.h      2006-05-05 20:11:43.000000000 +0900
 @@ -92,7 +92,7 @@
  #  define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv)
  #else
  #  ifdef HASATTRIBUTE_UNUSED
 -#    define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
 +#    define XS(name) void name(pTHX_ CV* cv PERL_UNUSED_DECL)
  #  else
  #    define XS(name) void name(pTHX_ CV* cv)
  #  endif