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

Right, I've tried google, and a look around the monastry, but haven`t found anything useful yet. We've got our C program running as a perl intepreteter
if ((my_perl = perl_alloc()) == NULL) { perror("Failed to create interpreter"); return 2; } perl_construct(my_perl); /* Run the startup script */ startup[0] = soapGlobals.service; startup[1] = soapGlobals.config; if (perl_parse(my_perl, xs_init, NumberOf(startup), startup, NULL) != 0) { perror ("Failed to parse startup file"); return 3; } /* Define the proper exit flags */ #ifdef PERL_EXIT_DESTRUCT_END PL_exit_flags |= PERL_EXIT_DESTRUCT_END; #endif /* Run the interpreter */ if (perl_run(my_perl) != 0) { perror ("Failed to run interpreter"); return 3; }
Our xs_init is pretty much taken from the perldocs
static void xs_init(pTHX) { char *file = __FILE__; dXSUB_SYS; /* Bring in the dynamic loader */ newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); }
Though I couldn`t find any mengion of dXSUB_SYS, but it is used within the perl souce code, having it there or having it removed doesn`t appear to make any difference anyway. Our snippet of perl that we are trying to use is:
use Enmac::Transaction; 1;
To basically use our own module. However when this is run on our dec boxes (TRU64) running perl 5.6.1 this works fine. On AIX5.2 with perl 5.8.2 we get the following error:
Can't load '/users/lib/modules/lib/perl5/site_perl/5.8.5/aix-64all/aut +o/Enmac/Transaction/Transaction.so' for module Enmac::Transaction: A +file or directory in the path name does not exist. at /usr/local/lib/ +perl5/5.8.5/aix-64all/DynaLoader.pm line 230.
Now the file does indeed exist in the place that is mentioned, but no other clues are given. Has anyone seen this before, or are there any other sagely words of wisdom/places to look.

Thanks

CJC

Replies are listed 'Best First'.
Re: perlembed problems
by tachyon (Chancellor) on Nov 13, 2004 at 07:31 UTC

    You appear to have 2 problems. First you need to check that your Enmac::Transaction module is properly installed. As a binary module it needs to be comiled for both 5.6 and 5.8 as these are not bin compat. perl(5.8) Makefile.PL where the version of perl you use to run the Makefile.PL determines which perl is used to do the install. Now check the version of perl you get (should be 5.8.x) and then run your module E::T module off the command line:

    $ perl -v This is perl, v5.6.2 built for i686-linux # should be 5.8.x for you [snip] $ perl -MSocket -e 'print $Socket::VERSION, $/'; 1.72 $ perl -MEnmac::Transaction -e 'print $Socket::VERSION, $/'; Can't locate Enmac/Transaction.pm in @INC (@INC contains: /usr/local/l +ib/perl5/5.6.2/i686-linux /usr/local/lib/perl5/5.6.2 /usr/local/lib/p +erl5/site_perl/5.6.2/i686-linux /usr/local/lib/perl5/site_perl/5.6.2 +/usr/local/lib/perl5/site_perl .). BEGIN failed--compilation aborted. $

    Now obviously this should work for both on your system. If it does not either your module is not installed for 5.8 (or if as you insist it is actually where it should be it will almost certainly be a permissions issue). Anyway this little test also proves that Socket (which needs Socket.so binary) will load OK under perl. Once you have that sorted you can then look at the embed code.

    With your embed widget try loading Socket - does that work or fail? You know it works from the command line. If it does there is no obvious reason why your E::T module won't work.

    Oh the dXSUB_SYS is mostly a NOOP unless you are on OS2. Perl has lots of macros - grep is your friend:

    [root@devel3 perl-5.8.3]# grep -R "#define dXSUB_SYS" ./* ./dosish.h:#define dXSUB_SYS ./epoc/epocish.h:#define dXSUB_SYS ./mpeix/mpeixish.h:#define dXSUB_SYS ./os2/os2ish.h:#define dXSUB_SYS OS2_XS_init() ./plan9/plan9ish.h:#define dXSUB_SYS ./unixish.h:#define dXSUB_SYS ./vms/vmsish.h:#define dXSUB_SYS [root@devel3 perl-5.8.3]#

    cheers

    tachyon

      hmmm... getting there slowly methinks

      The basic test program now handles E::T without any issues, so now it is down to our original crufty code.

      I'll have to start with our working code and morph it into the non working code to find out what's wrong. sigh... long day

      Thanks anyway

      CJC

      aha, Problem solved... it would appear that our build environment was broken.

      Our makefile for aix didn`t have

      perl -MExtUtils::Embed -e ldopts
      for defining the LDFLAGs needed at build time, indeed it was some other mad concotion that had some but not all of the appropriate libraries. I had been building my test program outwith our build and only discovered it when I dropped it into place to see what would happen

      Thanks for your help, now I'm off to slap some co-workers

      CJC (who will take no pleasure in dishing out the punishment ;)

Re: perlembed problems
by cassidyc (Sexton) on Nov 12, 2004 at 17:22 UTC
    Oh and just to confuse things, I made a dummy program taken from the perldocs for perlembed. Now if I use a file like:
    use Net::Config; 1;
    that works fine.

    Using the original file (replacing Net::Config with Enmac::Transaction) brings back the same error.

    However if I plug the working perl snippet into our original program I get a new error:

    Can't load '/usr/local/lib/perl5/5.8.5/aix-64all/auto/Socket/Socket.so +' for module Socket: (null) at /usr/local/lib/perl5/5.8.5/aix-64all/X +SLoader.pm line 68. at /usr/local/lib/perl5/5.8.5/aix-64all/Socket.pm line 399
    gah! it gets worse