gnu@perl has asked for the wisdom of the Perl Monks concerning the following question:

I have been requested to compile a perl script for execution on another unix box (same os level etc). The management does not want to install perl on this unit, it is a small appliance.

I have tried to use perlcc, but it failed and I don't know how to resolve the following error:

cmjohnso@deneb$ cp nc.pl nc.p cmjohnso@deneb$ perlcc nc.p Undefined first referenced symbol in file boot_Socket /var/tmp/cclPyavH.o boot_POSIX /var/tmp/cclPyavH.o boot_Fcntl /var/tmp/cclPyavH.o ld: fatal: Symbol referencing errors. No output written to ./a.out collect2: ld returned 1 exit status

Can anyone shed some light on this?

TIA, Chad.

Replies are listed 'Best First'.
Re: Using perlcc to compile stand alone code
by Jenda (Abbot) on Mar 27, 2003 at 15:34 UTC

    perlcc is (and it seems it will always be) experimental. Try PAR instead.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature

      I had looked into that, but it seems that is only for creating a perl archive (blib tree). It still requires the perl binary to execute it. Please correct me if I am wrong on this.

        The pp script installed with PAR will create a selfcontained executable. At least that's what the docs say. I wanted to try it, but have some problems.

        Jenda
        Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
           -- Rick Osborne

        Edit by castaway: Closed small tag in signature

Re: Using perlcc to compile stand alone code
by MZSanford (Curate) on Mar 27, 2003 at 15:04 UTC
    I have seen similar messages with modules loaded using require instead of use. Not sure if that is the case here with Socket, POSIX and Fcntl. Maybe a module being loaded is require'ing them ? Just a thought.
    from the frivolous to the serious
      Thanks, I'll have to check into that in the modules themselves. I have:
      use Fcntl ':flock'; use POSIX; use IO::Socket;
      in the beginning of my program, but perhaps one of the (or the others I am 'use'ing have 'require's in them.
Re: Using perlcc to compile stand alone code
by gnu@perl (Pilgrim) on Mar 27, 2003 at 16:38 UTC
    OK everybody, I figured it out with the tip from Jenda. Using PAR does work, but I don't use the PAR part of it. Once PAR is installed 'pp' is also installed.

    'pp' is a shell level program which takes a file name and creates an executable of it. Here is a link to the relavent part of the doc, for anyone that may be interested.

    Thanks All, your input was much appreciated.

      Just to resurrect this dead thread, perlcc still does not work in 2009: The following code runs, via the interpreter, just fine.
      C:\_Data\F15>perlcc bup-F15.pl C:\Perl\bin/perlcc.bat: bup-F15.pl did not compile, which can't happen +: Starting compile Walking tree Tk::Widget saved (it is in Tk::Label's @ISA) Forcing bootstrap of Tk::Widget DynaLoader saved (it is in Tk::Widget's @ISA) Tk saved (it is in Tk::Widget's @ISA) Exporter saved (it is in Tk's @ISA) IO::Socket saved (it is in IO::Socket::INET's @ISA) IO::Handle saved (it is in IO::Socket's @ISA) Tk::Toplevel saved (it is in Tk::FileSelect's @ISA) Tk::Wm saved (it is in Tk::Toplevel's @ISA) Tk::Frame saved (it is in Tk::Toplevel's @ISA) Tk::Derived saved (it is in Tk::Frame's @ISA) Tk::HList saved (it is in Tk::Tree's @ISA) Tk::Canvas saved (it is in Tk::ProgressBar's @ISA) Tk::Clipboard saved (it is in Tk::Listbox's @ISA) Forcing bootstrap of Tk::Image Encode::Encoding saved (it is in Encode::Unicode's @ISA) Tie::Watch saved (it is in Tie::Watch::Scalar's @ISA) File::Spec::Unix saved (it is in File::Spec::Win32's @ISA) Prescan Saving methods No definition for sub Socket::SO_PROTOCOL No definition for sub Socket::SO_PROTOCOL (unable to autoload) No definition for sub Socket::SO_DONTLINGER No definition for sub Socket::SO_DONTLINGER (unable to autoload) No definition for sub Fcntl::O_DSYNC No definition for sub Fcntl::O_DSYNC (unable to autoload) No definition for sub Socket::SO_CHAMELEON No definition for sub Socket::SO_CHAMELEON (unable to autoload) No definition for sub Socket::AF_ISO No definition for sub Socket::AF_ISO (unable to autoload) No definition for sub Socket::UIO_MAXIOV No definition for sub Socket::UIO_MAXIOV (unable to autoload) No definition for sub Fcntl::SEEK_SET No definition for sub Fcntl::SEEK_SET (unable to autoload) No definition for sub Socket::PF_MAX No definition for sub Socket::PF_MAX (unable to autoload) No definition for sub Socket::SO_SNDLOWAT No definition for sub Socket::SO_SNDLOWAT (unable to autoload) Bootstrap Encode::Unicode C:/Perl/lib/XSLoader.pm Bootstrap Encode C:/Perl/lib/XSLoader.pm No definition for sub Socket::AF_MAX No definition for sub Socket::AF_MAX (unable to autoload) No definition for sub Socket::MSG_BTAG No definition for sub Socket::MSG_BTAG (unable to autoload) No definition for sub Socket::PF_PUP No definition for sub Socket::PF_PUP (unable to autoload) Can't locate object method "IVX" via package "B::NV" at C:/Perl/lib/B +/C.pm line 650. CHECK failed--call queue aborted.
Re: Using perlcc to compile stand alone code
by chromatic (Archbishop) on Mar 27, 2003 at 16:35 UTC

    Can the target mount a remote filesystem? If so, another option is to put a Perl binary and the program on a share.