juda has asked for the wisdom of the Perl Monks concerning the following question:

Hi. I am working an XS tutorial example http://www.perl.com/pub/doc/manual/html/pod/perlxstut.html#EXAMPLE_4 which has you build a teeny library and build an XSUB (the perl extension, located in a .xs file). When I get to running "make", I run into a snag. Prior to this, when I run "perl Makefile.PL", I do get these warnings:
Warning (non-fatal): Target 'dynamic' depends on + targets in skipped section 'dy' Processing Makefile 'dynamic_bs' section Processing Makefile 'dynamic_lib' section Processing Makefile 'static' section Warning (non-fatal): Target 'static' depends on +targets in skipped section 'sta
Then, when I run "make" the following appears:
$ make mkdir ./blib mkdir ./blib/lib mkdir ./blib/arch mkdir ./blib/arch/auto mkdir ./blib/arch/auto/Mytest2 mkdir ./blib/lib/auto mkdir ./blib/lib/auto/Mytest2 mkdir ./blib/man3 cp Mytest2.pm ./blib/lib/Mytest2.pm AutoSplitting ./blib/lib/Mytest2.pm (./blib/lib/ +auto/Mytest2) cd mylib && make LIB="" LIBPERL_A="libperl.a" LI +NKTYPE="dynamic" PREFIX="/usr/l" cc -c -O -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\ +" -Kpic -I/usr/local/libc "./mylib.h", line 3: warning: const is a keyword + in ANSI C "./mylib.h", line 3: syntax error before or at: +const "./mylib.h", line 3: warning: undefined or missi +ng type for: const "mylib.c", line 9: syntax error before or at: co +nst "mylib.c", line 9: undefined or not a type: cons +t "mylib.c", line 9: cannot recover from previous +errors *** Error code 10 make: Fatal error: Command failed for target `my +lib.o' Current working directory /usr/home/judyf/perlwo +rk/Mytest2/mylib *** Error code 1 make: Fatal error: Command failed for target `my +lib/libmylib.a'
From the looks of that, it seems like it's not seeing the local typemap even though I specified the full path to it in MakeMaker (in Makefile.PL, namely:
'TYPEMAPS' => '/home/juda/perlwork/Mytest2/typem +ap',
I should mention that an incomplete perl installation was initially performed on this Solaris 2.5.1 box and the sysadmin recently re-installed after I noticed that key componments were missing. He installed perl5.00405. When I type "perl 'V" it lists:
$ perl -V Summary of my perl5 (5.0 patchlevel 4 subversion + 5) configuration: Platform: osname=solaris, osvers=2.5.1, archname=sun4-sola +ris uname='sunos betaman.portsoft.com 5.5.1 generic_ +103640-26 sun4u sparc sunw,' hint=recommended, useposix=true, d_sigaction=def +ine bincompat3=n useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O', gccversion= cppflags='' ccflags ='' stdchar='unsigned char', d_stdstdio=define, usev +fork=false intsize=4, longsize=4, ptrsize=undef, doublesize +=undef alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc -lcrypt libc=/lib/libc.so, so=so useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, c +cdlflags=' ' cccdlflags='-Kpic', lddlflags='-G -L/usr/local/l +ib' Characteristics of this binary (from libperl): Built under solaris @INC: /usr/local/lib/perl5/sun4-solaris/5.00405 /usr/local/lib/perl5 /usr/local/lib/perl5/site_perl/sun4-solaris /usr/local/lib/perl5/site_perl
My understanding is that a lot of the perl stuff is intertwined where the installed perl and the extension development environment is concerned. I am suspicious that it might have something to do with our local perl setup since this XSUB example is very basic, the equivalent of "Hello, world" to run from a C library, called from perl. Any suggestions are appreciated. Thanks, Juda

Replies are listed 'Best First'.
RE: try #3 with XS tutorial question
by Anonymous Monk on May 31, 2000 at 06:18 UTC
    No "aha!" here, but besides the concern about the "targets in skipped section" warning (that can't be good) I usually see "syntax error before ..." when I'm missing include files/defines. In my case, the line before is not being 'found' (has a keyword/def that doesn't get preprocessed into a valid sequence) and the compiler goes on to choke on the next line. I often end up doing a: cd /usr/include grep "<missing word>" * grep "<missing word>" */* grep "<missing word>" */*/* just to see where it is and what includes might be needed. I'm sure there's a better route; have you seen the XS tutorial at http://www.perlmonth.com (look in the earlier editions)? a
      Thanks for the reply. Yes, it appears to be missing info, in this case type definitions. I'm pretty sure it's not seeing the local typemap file or at least, not parsing it correctly. This makes me suspicious that it's my installation of perl. The interesting thing is that the other 3 XS tutorial examples work just fine. I'll check out the URL you mentioned. I have not seen it, only the one I mentioned. BTW, do you know which perl version is currently considered the stablest/best. I've heard that 5.6 is too new to be stable and versions older than 5.00503 are too old.