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

Recently I came back to some embedded perl I wrote some time ago, only this time the perl stuff did not compile. The compiler can't find the definitions of things like push_scope, save_int, stack_grow which are defined by the #define's ENTER, SAVETMPS, PUSHMARK etc. I have included the needed <EXTERN.h> and <perl.h> in that order. I tried working through all the #defines to get to the native embedded assembly, but it just was not work, however the easy things like Perl_ functions where now defined. I figured this was probably a common problem. So I suppose I'm missing something. I went from v5.8.0 to 5.8.5 with a new system build, so its possible I left out a path or lib or something, although this project is exactly the same. I thought all my dependencies stuff was fine in the makefiles. Never had a problem before. Thanks in advance. ~Steve

Replies are listed 'Best First'.
Re: Am I missing something?
by Zaxo (Archbishop) on May 27, 2005 at 21:22 UTC

    You haven't given us many clues. You need to show us the code and the error messages.

    Perl 5.8.0 is binary incompatible with 5.8.5, which may or may not have anything to do with your troubles. Devel::PPPort may be helpful for change-proofing your application.

    After Compline,
    Zaxo

      Perl 5.8.0 is binary incompatible with 5.8.5
      Well, it's supposed to be compatible. We generally only break compatibility when the x in 5.x.y changes.

      Dave.

        Before folks start jumping to conclusions please read carfully:

        I really don't think its a binary issue since I'm not even using the binary. I'm linking with the -lperl -lcrypt libs, with includes files loocated typically in /usr/lib/perl5/5.8.X/i586-linux-thread-multi/CORE

        I'm running an embedded perl script in some C++ code, using one of the commonly available example perl stack routines.
        int psCheck( const char* prog_name ) { dSP; int ret; int count = 0; ENTER; SAVETMPS; PUSHMARK( SP ); XPUSHs( sv_2mortal( newSVpv( prog_name, 0 ) ) ); PUTBACK; ret = call_pv("psCheck", G_SCALAR); SPAGAIN; if (ret != 1) croak("Big trouble\n" ; count = POPi; PUTBACK; FREETMPS; LEAVE; return count; }


        The errors:
        adaptermain.cpp: In function `int psCheck(const char*)': *adaptermain.cpp:365: error: `push_scope' undeclared (first use this f +unction) *adaptermain.cpp:365: error: (Each undeclared identifier is reported o +nly once *for each function it appears in.) *adaptermain.cpp:366: error: `save_int' undeclared (first use this fun +ction) *adaptermain.cpp:368: error: `markstack_grow' undeclared (first use th +is function) *adaptermain.cpp:369: error: `stack_grow' undeclared (first use this f +unction) *adaptermain.cpp:369: error: `newSVpv' undeclared (first use this func +tion) *adaptermain.cpp:369: error: `sv_2mortal' undeclared (first use this f +unction) *adaptermain.cpp:372: error: `call_pv' undeclared (first use this func +tion) *adaptermain.cpp:377: error: `croak' undeclared (first use this functi +on) *adaptermain.cpp:379: error: `sv_2iv' undeclared (first use this funct +ion) *adaptermain.cpp:381: error: `free_tmps' undeclared (first use this fu +nction) *adaptermain.cpp:382: error: `pop_scope' undeclared (first use this fu +nction)


        All the routines defined within the MACRO definitions come back as undefined. For example ENTER, which uses push_scope, my compiler (3.3.3) says is undefined. I recall this issue way back when I wrote this code and for the life of me I can't figure out what I did to fix it then.

        I have included the needed <EXTERN.h> and <perl.h> files.

        Whatever is needed to be done, I'm sure it has nothing to do with compilation options, makefiles or code since this was all fine before and I have handled then in my makefiles. It must be an environment issue which I might have been left out (LD_LIBRARY_PATH, or PATH for example).

        This does not seem to be a very generic issue, since google turns up little, that is applicable.