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

Again, I have been instructed to compile some perl. The customer doesn't want the perl interpreter on the system.

Here are the results:

[PerlThreads]# perlcc -o sh2 sh2.pl In file included from /usr/lib/perl/5.8/CORE/perl.h:3950, from pccE2dTY.c:2: /usr/lib/perl/5.8/CORE/proto.h:31: warning: `warn_unused_result' attri +bute directive ignored ... lots of warnings... /usr/lib/perl/5.8/CORE/proto.h:2291: warning: `warn_unused_result' att +ribute directive ignored /usr/lib/perl/5.8/CORE/proto.h:2294: warning: `warn_unused_result' att +ribute directive ignored pccE2dTY.c: In function `perl_init_aaaa': pccE2dTY.c:3687: warning: this decimal constant is unsigned only in IS +O C90 /usr/bin/ld: cannot find -lperl collect2: ld returned 1 exit status [PerlThreads]#

Based upon the error message's library name ( -lperl; no .so) I surmise it is looking for a static library. Searching the system produces:

[PerlThreads]# find / -name "libperl*" /var/lib/dpkg/info/libperl5.8.list /var/lib/dpkg/info/libperl5.8.postinst /var/lib/dpkg/info/libperl5.8.md5sums /var/lib/dpkg/info/libperl5.8.shlibs /var/cache/apt/archives/libperl5.8_5.8.8-4_i386.deb /usr/lib/libperl.so.5.8 /usr/lib/libperl.so.5.8.8 /usr/share/doc/libperl5.8 /usr/share/defoma/libperl-file.pl /usr/share/defoma/libperl-hint.pl [PerlThreads]#

Shows 2 dynamic libraries, but not a static one. Is this an installation problem on my part? Do I need to CPAN something else to use the compiler?

Replies are listed 'Best First'.
Re: perlcc can't find libperl
by Fletch (Bishop) on Dec 07, 2006 at 18:47 UTC

    You really don't want perlcc; it was never more than experimental and didn't really work well even if it did compile something.

    Look at PAR instead; it actually is supported and works much more frequently.

      I really do want "perlcc" as directed in the requirements document. Not my call.

      But; checking Knoppic 3.8 & 5.01, and RHEL 4 WS, none of these have a non-dynamic library.

      Only my FreeBSD 4.11 has a ".a" library (5.8.5)

        Then your best option is to point whomever came up with the demented requirement to use "perlcc" in the first place and educate them that:

        If that doesn't fix the problem, my condolences.

        I really do want "perlcc" as directed in the requirements document. Not my call.

        Unfortunately, you'll probably have to support it yourself, as absolutely no one as shown any serious interest in doing so on p5p for several years. The rough but apparently unanimous consensus is that it doesn't work, it hasn't worked for a long time, and it's very unlikely to work ever.

        I don't say this to discourage you, and it's not a technical impossibility to get it to work, but none of the people I know who might have the skill to make it work have done so.

        In fact, now that I think about it, just make it and see if this changes things:

        cd /usr/lib ln -s libperl.so.5.8.8 /usr/lib/libperl.so ln -s libperl.so.5.8 /usr/lib/libperl.so
        Then see if you still get the "-lperl" missing message.

        non-Perl: Andy Ford

        Do they have a plain libperl.so with no version numbers?

        non-Perl: Andy Ford

Re: perlcc can't find libperl
by andyford (Curate) on Dec 07, 2006 at 17:55 UTC

    I think your assumption about "-lperl" looking for a static library is mistaken.
    I guess this could vary by system, but I am surprised to see only

    /usr/lib/libperl.so.5.8 /usr/lib/libperl.so.5.8.8
    Usually for every libFoo.so.x.y, there's a libFoo.so that's a symbolic link to the one with the full version number.
    Could there be a problem with your installation?

    non-Perl: Andy Ford

Re: perlcc can't find libperl
by ysth (Canon) on Dec 07, 2006 at 23:26 UTC
    If the requirements mandate perlcc be used, I'd recommend you inform the customer that you need a minimum of 6-12 months development time to get perlcc fully working before you can confidently use it.