Subject: pkg/33403: Can't build perl module written by C++
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <obata@lins.jp>
List: pkgsrc-bugs
Date: 05/01/2006 12:45:00
>Number:         33403
>Category:       pkg
>Synopsis:       Can't build perl module written by C++
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 01 12:45:00 +0000 2006
>Originator:     OBATA Akio
>Release:        NetBSD 3.0.0_STABLE
>Organization:
	LINS, Japan.
>Environment:
System: NetBSD miki.lins.jp 3.0.0_STABLE NetBSD 3.0.0_STABLE (MIKI) #16: Sun Mar 12 21:01:46 JST 2006 obata@miki.lins.jp:/usr/src/sys/arch/i386/compile/MIKI i386
Architecture: i386
Machine: i386
>Description:
	Can't build perl module written by C++ with perl 5.8.8nb1.
	With perl 5.8.7, it was OK.

>How-To-Repeat:

	For example, in pkgsrc-wip:

% cd /usr/pkgsrc/wip/p5-mecab
% make
===> Checking for vulnerabilities in p5-mecab-0.91
=> Checksum SHA1 OK for mecab-perl-0.91.tar.gz.
=> Checksum RMD160 OK for mecab-perl-0.91.tar.gz.
===> Extracting for p5-mecab-0.91
===> Required installed package mecab>=0.90: mecab-0.91 found
===> Required installed package mecab-base>=0.90: mecab-base-0.91 found
===> Required installed package perl>=5.8.7: perl-5.8.8nb1 found
===> Patching for p5-mecab-0.91
===> Overriding tools for p5-mecab-0.91
===> Creating toolchain wrappers for p5-mecab-0.91
===> Configuring for p5-mecab-0.91
Checking if your kit is complete...
Looks good
Writing Makefile for MeCab
===> 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
In file included from MeCab_wrap.cxx:708:
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h:2700: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h:2710: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h:2710: error: syntax
   error before `)' token
In file included from /usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/iperlsys.h:51,
                 from /usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h:2733,
                 from MeCab_wrap.cxx:708:
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:117: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `void PerlIO_define_layer(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:118: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `PerlIO_funcs* PerlIO_find_layer(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:121: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `PerlIOl** PerlIO_push(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:123: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `void PerlIO_pop(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:124: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `AV* PerlIO_get_layers(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:125: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `void PerlIO_clone(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:220: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `void PerlIO_init(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:233: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `PerlIOl** PerlIO_openn(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:351: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `PerlIOl** PerlIO_fdupopen(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:360: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `int PerlIO_apply_layers(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:364: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `int PerlIO_binmode(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:371: error: parse
   error before `__attribute__'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h: In
   function `void PerlIO_destruct(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perlio.h:376: error: parse
   error before `__attribute__'
In file included from /usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h:2746,
                 from MeCab_wrap.cxx:708:
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/regexp.h: In
   function `void PerlIO_cleanup(...)':
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/regexp.h:31: error: declaration
   of `struct regexp' in `void PerlIO_cleanup(...)' which does not enclose `::'
/usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/regexp.h:31: confused by earlier errors, bailing out
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/wip/p5-mecab/work/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
===>      * /usr/pkgsrc/wip/p5-mecab/work/.work.log
===>
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/wip/p5-mecab

>Fix:
	If modify perl.h by the following patch, build fine.

--- /usr/pkg/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h.orig   2006-04-13 10:28:48.000000000 +0900
+++ /usr/pkg/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h   2006-05-01 20:51:33.000000000 +0900
@@ -150,6 +150,10 @@
 #  define CALLPROTECT CALL_FPTR(PL_protect)
 #endif

+#if !defined(__attribute__) || !defined(__GNUC__)
+#define __attribute__(x)
+#endif
+
 #if defined(SYMBIAN) && defined(__GNUC__)
 #  ifdef __cplusplus
 #    define PERL_UNUSED_DECL