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

Hey guys
When I try to compile a perl script, or try to translate it into C code using the command
perl -MO=CC,-ohi.c hi.pl
or
perl -MO=byte hi.pl
I get an error like
Can't locate object method "fake_ppaddr" via package "B::FAKEOP" at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/B/C.pm line 365. CHECK failed--call queue aborted.
I have the B::C, and B::CC modules loaded, what could be wrong?
My perl script is simply
#!/usr/bin/perl print "Hello";

Any suggestions

Replies are listed 'Best First'.
Re: Compiling Perl
by borisz (Canon) on Jun 16, 2004 at 15:19 UTC
    Try perlcc hi.pl instead. Or  perl -MO=Bytecode,-H,-ohi -e 'print "hi!\n"' to generate bytecode. See perldoc B::Bytecode.
    Boris
Re: Compiling Perl
by Anonymous Monk on Jun 16, 2004 at 15:11 UTC
    • you have an old perl
    • its an experimental feature
    • try super search or google , maybe you'll get lucky
Re: Compiling Perl
by diotalevi (Canon) on Jun 16, 2004 at 17:20 UTC

    Compiling a perl program to C or bytecode does not work well. I suggest you not bother. Please do follow up with what your actual goal here is and why you thought that compiling to C or bytecode was a good idea.

    If your goal is to end up with a packaged executable for running a program, see PAR - the current best practice. If your goal is to obscure your program's source code so others cannot see it, see B::Deobfuscate and Here is a commercial obfuscator.

      The Intent of this is because I am writing a freeware version of a script to release on the net, and I want to make it tougher for people to remove the copyright notice
      Are there any linux equiv's of PAR? or pp. I dont want to run windows *shudders* and pp seems to only make .exe files

        Read the documentation closer. Nearly all of the examples are performed from the context of some sort of unix shell. If you intend to distribute your script using this you'll need to provide separate versions for each of the odd dozen current different builds of libc and glibc and then each of the operating systems you'd like to allow your script to be run on...

        This is why this stuff typically is distributed as source - because it is really, really difficult to get binary executables that work on computers that aren't identical to yours.