[rt.cpan.org #81172] using Inline with => 'Event' fails to compile

[email protected] ("Peter Smoczynski via RT")
Newsgroups perl.inline
Message-ID <[email protected]>
Fri Nov 16 05:35:12 2012: Request 81172 was acted upon.
Transaction: Correspondence added by [email protected]
       Queue: Inline
     Subject: [rt.cpan.org #81172] using Inline with => 'Event' fails to compile
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=81172 >


Sorry for the confusion!

1stly 0.51 does not find EventAPI.h b'of an incorrect generated gcc 
comandline:

Sun-A3 root 259/0 (~/peter/inline_fails_to_compile)# 
/opt/perl5.12.2.debug/bin/perl -c compile_test_1.t
/opt/perl5.12.2.debug/bin/perl 
/opt/perl5.12.2.debug/lib/5.12.2/ExtUtils/xsubpp  -typemap 
"/opt/perl5.12.2.debug/lib/5.12.2/ExtUtils/typemap" -typemap 
"/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event/typemap" 
compile_test_1_t_a7b1.xs > compile_test_1_t_a7b1.xsc && mv 
compile_test_1_t_a7b1.xsc compile_test_1_t_a7b1.c
gcc -c  -I"/root/peter/inline_fails_to_compile" "-I 
/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event" 
-I/usr/local/include -I/usr/local/BerkeleyDB.4.5/include -DDEBUGGING 
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -g   
-DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC 
"-I/opt/perl5.12.2.debug/lib/5.12.2/i86pc-solaris/CORE" 
compile_test_1_t_a7b1.c
compile_test_1_t_a7b1.xs:5:22: error: EventAPI.h: No such file or directory
compile_test_1_t_a7b1.xs:6: error: expected ')' before '*' token
compile_test_1_t_a7b1.c: In function 'XS_main_evdmp_event_c':
compile_test_1_t_a7b1.c:99: error: 'pe_event' undeclared (first use in 
this function)
compile_test_1_t_a7b1.c:99: error: (Each undeclared identifier is 
reported only once
compile_test_1_t_a7b1.c:99: error: for each function it appears in.)
compile_test_1_t_a7b1.c:99: error: 'event' undeclared (first use in this 
function)
compile_test_1_t_a7b1.c:99: error: expected expression before ')' token
make: *** [compile_test_1_t_a7b1.o] Error 1

i.e.

gcc -c  -I"/root/peter/inline_fails_to_compile" "-I 
/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event" 
-I/usr/local/include -I/usr/local/BerkeleyDB.4.5/include -DDEBUGGING 
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -g   
-DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC 
"-I/opt/perl5.12.2.debug/lib/5.12.2/i86pc-solaris/CORE" 
compile_test_1_t_a7b1.c

where

"-I /opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event"

fails to include EventAPI.h.

if I change into the build directory and issue the same cmd with the -I 
option manually corrected to

-I"/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event"

gcc now does find the EventAPI.h and since it then got the necessary 
definitions can resolve "pe_event" at line 6 of the generated .xs file

   1 #include "EXTERN.h"
   2 #include "perl.h"
   3 #include "XSUB.h"
   4 #include "INLINE.h"
   5 #include "EventAPI.h"
   6 void evdmp_event_c (pe_event * event)
_Inline/build/compile_test_1_t_a7b1/compile_test_1_t_a7b1.xs
:set nu

  i.e.

Sun-A3 root 293/1 
(~/peter/inline_fails_to_compile/_Inline/build/compile_test_1_t_a7b1)# 
gcc -c -I"/root/peter/inline_fails_to_compile" 
-I"/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event" 
-I/usr/local/include -I/usr/local/BerkeleyDB.4.5/include -DDEBUGGING 
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -g 
-DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC 
"-I/opt/perl5.12.2.debug/lib/5.12.2/i86pc-solaris/CORE" 
compile_test_1_t_a7b1.c
Sun-A3 root 294/0 
(~/peter/inline_fails_to_compile/_Inline/build/compile_test_1_t_a7b1)#

I better should have added the code of compile_test_2.t since I did 
misunderstand you there..!

   1 #!/opt/perl5.12.2.debug/bin/perl
   2
   3 use strict;
   4 use warnings;
   5
   6 ##use Inline with => 'Event';
   7 ##
   8 use Inline C => Config =>
   9    BUILD_NOISY => 1;
  10
  11 use Inline C => <<'EOC_EVDMP_EVENT_C';
  12 void evdmp_event_c (pe_event * event)
  13 {
  14     char *classname = HvNAME(SvSTASH(SvRV(event->mysv)));
  15
  16     printf("evdmp_event_c()\ne type: %s\ne hits: %d\ne prio %d\n",
  17        classname,
  18        event->hits,
  19        event->prio
  20     );
  21
  22     if (strcmp(classname, (const char *) "Event::Event::Io") == 0)
  23     {
  24        printf("e got: %u\n", ((pe_ioevent *) event)->got);
  25     }
  26
  27 }
  28 EOC_EVDMP_EVENT_C
  29
  30 exit 0;
  31
~
compile_test_2.t
:set nu

of course if I comment-out the "##use Inline with => 'Event';" line 
there, no definitions for gcc and thus the error with 0.48 in my 
previous mail.

i.e. no -I 
/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event on the 
commandline:

/opt/perl5.12.2.debug/bin/perl 
/opt/perl5.12.2.debug/lib/5.12.2/ExtUtils/xsubpp  -typemap 
/opt/perl5.12.2.debug/lib/5.12.2/ExtUtils/typemap 
compile_test_2_t_a7b1.xs > compile_test_2_t_a7b1.xsc && mv 
compile_test_2_t_a7b1.xsc compile_test_2_t_a7b1.c
gcc -c  -I/root/peter/inline_fails_to_compile -I/usr/local/include 
-I/usr/local/BerkeleyDB.4.5/include -DDEBUGGING -fno-strict-aliasing 
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -g -DVERSION=\"0.00\" 
-DXS_VERSION=\"0.00\" -fPIC 
"-I/opt/perl5.12.2.debug/lib/5.12.2/i86pc-solaris/CORE" 
compile_test_2_t_a7b1.c
compile_test_2_t_a7b1.xs:5: error: expected ')' before '*' token
make: *** [compile_test_2_t_a7b1.o] Error 1

sorry!, for being stupid! this was not what you wanted me to do!

so here is a corrected compile_test_2.t:

#!/opt/perl5.12.2.debug/bin/perl

use strict;
use warnings;

use Inline with => 'Event';
## set build traces
use Inline C => Config =>
    BUILD_NOISY => 1;

use Inline C => <<'EOC_EVDMP_EVENT_C';
void evdmp_event_c (pe_event * event)
{
     char *classname = HvNAME(SvSTASH(SvRV(event->mysv)));

     printf("evdmp_event_c()\ne type: %s\ne hits: %d\ne prio %d\n",
        classname,
        event->hits,
        event->prio
     );

     if (strcmp(classname, (const char *) "Event::Event::Io") == 0)
     {
        printf("e got: %u\n", ((pe_ioevent *) event)->got);
     }

}
EOC_EVDMP_EVENT_C

exit 0;

~
"compile_test_2.t" 31L, 599C

which yields a clean run with version 0.48:

Sun-A3 root 276/0 (~/peter/inline_fails_to_compile)# 
/opt/perl5.12.2.debug/bin/perl compile_test_2.t
Starting Build Preprocess Stage
Finished Build Preprocess Stage

Starting Build Parse Stage
Finished Build Parse Stage

Starting Build Glue 1 Stage
Finished Build Glue 1 Stage

Starting Build Glue 2 Stage
Finished Build Glue 2 Stage

Starting Build Glue 3 Stage
Finished Build Glue 3 Stage

Starting Build Compile Stage
   Starting "perl Makefile.PL" Stage
Writing Makefile for compile_test_2_t_a7b1
   Finished "perl Makefile.PL" Stage

   Starting "make" Stage
/opt/perl5.12.2.debug/bin/perl 
/opt/perl5.12.2.debug/lib/5.12.2/ExtUtils/xsubpp  -typemap 
/opt/perl5.12.2.debug/lib/5.12.2/ExtUtils/typemap -typemap 
/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event/typemap 
compile_test_2_t_a7b1.xs > compile_test_2_t_ a7b1.xsc && mv 
compile_test_2_t_a7b1.xsc compile_test_2_t_a7b1.c
gcc -c  -I/root/peter/inline_fails_to_compile -I 
/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/Event 
-I/usr/local/include -I/usr/local/BerkeleyDB.4.5/include -DDEBUGGING 
-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -g   
-DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC 
"-I/opt/perl5.12.2.debug/lib/5.12.2/i86pc-solaris/CORE" 
compile_test_2_t_a7b1.c
Running Mkbootstrap for compile_test_2_t_a7b1 ()
chmod 644 compile_test_2_t_a7b1.bs
rm -f blib/arch/auto/compile_test_2_t_a7b1/compile_test_2_t_a7b1.so
gcc  -G -L/usr/local/lib -Wl,-R/usr/local/lib 
-L/usr/local/BerkeleyDB.4.5/lib -Wl,-R/usr/local/BerkeleyDB.4.5/lib 
-fstack-protector compile_test_2_t_a7b1.o  -o 
blib/arch/auto/compile_test_2_t_a7b1/compile_test_2_t_a7b1.so 
/opt/perl5.12.2.debug/lib/site_perl/5.12.2/i86pc-solaris/auto/Event/Event.so 
\
                 \

chmod 755 blib/arch/auto/compile_test_2_t_a7b1/compile_test_2_t_a7b1.so
cp compile_test_2_t_a7b1.bs 
blib/arch/auto/compile_test_2_t_a7b1/compile_test_2_t_a7b1.bs
chmod 644 blib/arch/auto/compile_test_2_t_a7b1/compile_test_2_t_a7b1.bs
   Finished "make" Stage

   Starting "make install" Stage
Files found in blib/arch: installing files in blib/lib into architecture 
dependent library tree
Installing 
/root/peter/inline_fails_to_compile/_Inline/lib/auto/compile_test_2_t_a7b1/compile_test_2_t_a7b1.bs
Installing 
/root/peter/inline_fails_to_compile/_Inline/lib/auto/compile_test_2_t_a7b1/compile_test_2_t_a7b1.so
   Finished "make install" Stage

   Starting Cleaning Up Stage
   Finished Cleaning Up Stage

Finished Build Compile Stage

Sun-A3 root 277/0 (~/peter/inline_fails_to_compile)#

sorry again!
cheers, peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.