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: Johnny C. Lam <jlam@pkgsrc.org>
List: pkgsrc-bugs
Date: 05/03/2006 02:25:02
The following reply was made to PR pkg/33403; it has been noted by GNATS.

From: "Johnny C. Lam" <jlam@pkgsrc.org>
To: obata@lins.jp
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/33403: Can't build perl module written by C++
Date: Wed, 3 May 2006 02:20:49 +0000

 --EVF5PPMfhYS0aIcm
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Tue, May 02, 2006 at 01:35:06AM +0000, OBATA Akio wrote:
 >  On Tue, 02 May 2006 10:28:58, Johnny C. Lam wrote:
 >  > Could you please try the attached patch?  I believe it is more in the
 >  > spirit of how the Perl developers are currently trying to handle GCC
 >  > __attribute__ expressions in the Perl codebase.  Please let me know if
 >  > this works for you.
 >  
 >  Same error occured.
 >  
 >  ===> Building for p5-mecab-0.91
 >  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:2704: error: parse
 >     error before `__attribute__'
 >  /usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h:2714: error: parse
 >     error before `__attribute__'
 >  /usr/pkgsrc/wip/p5-mecab/work/.buildlink/lib/perl5/5.8.0/i386-netbsd-thread-multi/CORE/perl.h:2714: error: syntax
 >     error before `)' token
 
 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.
 
 	Thanks,
 
 	-- Johnny Lam <jlam@pkgsrc.org>
 
 --EVF5PPMfhYS0aIcm
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch-aq
 
 $NetBSD$
 
 --- perl.h.orig	2006-01-13 13:17:12.000000000 -0500
 +++ perl.h
 @@ -150,6 +150,15 @@ struct perl_thread;
  #  define CALLPROTECT CALL_FPTR(PL_protect)
  #endif
  
 +/* GCC versions prior to 3.4 have a bug handling the "unused" attribute
 + * in declarations when compiling C++ code.
 + */
 +#if defined(__GNUC__) && defined(__cplusplus)
 +#  if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
 +#    define PERL_UNUSED_DECL
 +#  endif
 +#endif
 +
  #if defined(SYMBIAN) && defined(__GNUC__)
  #  ifdef __cplusplus
  #    define PERL_UNUSED_DECL
 @@ -2375,7 +2384,11 @@ typedef struct clone_params CLONE_PARAMS
  #    define HASATTRIBUTE_PURE
  #  endif
  #  if __GNUC__ >= 3 /* gcc 3.0 -> */ /* XXX Verify this version */
 -#    define HASATTRIBUTE_UNUSED
 +#    if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3) /* 3.4 -> */
 +#      define HASATTRIBUTE_UNUSED
 +#    elif !defined(__cplusplus)
 +#      define HASATTRIBUTE_UNUSED
 +#    endif
  #  endif
  #  if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
  #    define HASATTRIBUTE_WARN_UNUSED_RESULT
 
 --EVF5PPMfhYS0aIcm--