[haiku] Re: Perl XS problems

  • From: Sean Healy <jalopeura@xxxxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Fri, 13 Mar 2009 16:33:53 +0100

Ingo Weinhold wrote:
On 2009-03-12 at 23:09:20 [+0100], Sean Healy <jalopeura@xxxxxxxxxxx> wrote:
I'm writing a Perl extension to interface with Haiku's kits. I'm getting
errors from Perl's own header files. However, since somebody (apparently
Ingo) was able to build Perl on Haiku in the first place, I'm sure there
is a solution. If anyone can help point me in the right direction, that
would be great.

(By the way, I'm using the 2.95 compiler. I verified that Perl was also
built with the 2.95 compiler.)

/boot/common/bin/perl /boot/common/lib/perl5/5.10.0/ExtUtils/xsubpp
-C++ -typemap /boot/common/lib/perl5/5.10.0/ExtUtils/typemap -typemap
typemap  ApplicationKit.xs > ApplicationKit.xsc && mv ApplicationKit.xsc

Please specify prototyping behavior for ApplicationKit.xs (see perlxs

Not sure what this is supposed to mean. I guess checking out the perlxs manual as suggested might help.

Apparently, xsubpp is just being picky. It wants XS files to use the PROTOTYPES directive, but works just fine without it. So this problem turned out to be a) not a Haiku issue, and b) not really an issue anyway.

g++ -c  -I. -fno-strict-aliasing -pipe -O   -DVERSION=\"0.01\"
-DXS_VERSION=\"0.01\" -fpic
"-I/boot/common/lib/perl5/5.10.0/BePC-haiku/CORE"   ApplicationKit.c

In file included from
/boot/common/lib/perl5/5.10.0/BePC-haiku/CORE/perl.h:1586: badly
punctuated parameter list in `#define'
/boot/common/lib/perl5/5.10.0/BePC-haiku/CORE/perl.h:1598: badly
punctuated parameter list in `#define'

This is interesting. Apparently the gcc 2.95.3 C compiler supports C99 variadic macros while the C++ compiler doesn't. Perl itself is C only, so there was no problem with building it. You could try to undef the HAS_C99_VARIADIC_MACROS macro in config.h. Maybe that will work.

At any rate, please file a bug report at HaikuPorts.

Yes, that worked. Hopefully it won't have any unexpected side effects.

I have requested a HaikuPorts account so I can file a bug report.

In file included from
haiku/haikuish.h: No such file or directory

Ugh, that file has apparently not been installed. Not sure why -- I might have missed adding it to some file listing. You can get it from the patch on HaikuPorts (Scott sent the link to the port log); it's only a few lines long. The file must probably live in .../BePC-haiku/CORE/haiku/.

Again, please file a bug report at HaikuPorts.

That was apparently the right place, as it cleared up the problem.

In file included from
Invalid token in expression

After some searching, I discovered that ppport is apparently not necessary. It's basically a way to make some newer Perl features available to older versions. Since Haiku is new, presumably the vast majority of people who might compile my extension will be not be using one of the older versions. So for now I simply commented out the include.

The offending line, by the way, is contained within

#if (PERL_BCDVERSION < 0x5004063)

so I'm not sure why it's even being compiled. PERL_BCDVERSION is defined via PERL_REVISION, PERL_VERSION, and PERL_SUBVERSION, all of which seem to be set properly in patchlevel.h

In file included from
/boot/common/lib/perl5/5.10.0/BePC-haiku/CORE/proto.h:211: parse error
before `*'

Nothing obvious wrong here. Run the above g++ line with "-E" instead of "-c" and a different output file and check what this line is preprocessed to.

In file included from
/boot/common/lib/perl5/5.10.0/BePC-haiku/CORE/intrpvar.h:85: syntax
error before `;'
/boot/common/lib/perl5/5.10.0/BePC-haiku/CORE/intrpvar.h:86: syntax
error before `;'

Same here.

These last several errors went away when I added haikuish.h.

CU, Ingo

The extension now compiles. Thanks for the help.

Other related posts: