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

Dear Monks,

I'm trying to build a completely static release of 5.8.7 on <unpopular version of Unix>, but seem to be failing. I've passed -Uusedl to configure, but it appears that this is being ignored - for example, all the ext modules say they are being built dynamically, and the test for Time::HiRes fail with a dynamic linker error.

Additionally, when built, the new binary seems about 50% slower when running very small scripts when compared to our old, static, 5.8.0 binary (I wish someone documented how they built it!). My guess is that this is due to the loading dynamic objects.

Can anyone help out?

Replies are listed 'Best First'.
Re: static build of perl - how?
by socketdave (Curate) on Jul 18, 2005 at 13:16 UTC
    I don't have a SCO box to test on, but this seems a bit suspicious... You mention Time::HiRes specifically. From Changes5.8 in the 5.8.7 distribution:
     10953 By: jhi                                   on 2001/06/26  12:33:55
            Log: Subject: PATCH ext/Time/HiRes/Makefile.PL perl@10929 Test Fails on SCO
                 From: Jonathan Stowe <gellyfish@gellyfish.com>                          
                 Date: Tue, 26 Jun 2001 10:29:57 +0100 (BST)   
                 Message-ID: <Pine.LNX.4.33.0106261021540.18774-100000@orpheus.gellyfish.com>
                 
                 SCO OpenServer 5.0.5 needs an explicit -lc for usleep().
         Branch: perl                                                    
               + ext/Time/HiRes/hints/sco.pl
               ! MANIFEST
    

    If I were you, I might try compiling a 5.6 Perl.
      Yes - I did see this - but the resulting Makefile doesn't seem to use it. There is a comment about it being a MakeMaker parameter, but it isn't used anywhere else in the Makefile. I have got around this particular issue by adding -Dstatic_ext="Time/HiRes" when configuring - but this isn't really my problem, and there must be a better way than specifying every single module this way.

      My problem is that I want a static build of perl (executable and modules) that I can send out to my clients - specifically, I need libraries such as curses, openssl and expat, but would rather include them statically in the perl executable than have to use shared objects (some clients may already have these libraries, but older/newer versions, and I don't want to trample all over them). I can live with inflated perl binary sizes.

      When compiling some of the modules we need, I recall that at least one required a version 5.8.x release of perl - so 5.6.x is a non-starter, unfortuately.

      Thanks for the suggestion, though ;>

        maybe you could use a tool like par (or ActiveState Perl Dev Kit, though I think it doesn't support SCO UNIX).

        It can pack your scripts and modules with libperl, all the dlls required by your program and a small loader in one file for easy distribution.

Re: static build of perl - how?
by ysth (Canon) on Jul 19, 2005 at 06:48 UTC
    Could you post your entire config.sh, please? With <readmore> tags around it.

    Undefining usedl definitely should work to link perl's extensions staticly; I don't know that it has any effect on how external libraries like curses, expat, etc. are linked.

      Ysth,

      I've noticed that even though I configured with -Uusedl, usedl is *still* defined. I'm going to set it to undef manually and rebuild to see if that makes any difference.

      Thanks.

      Here's my config.sh:

        Ysth,

        I've manually hacked Configure to write usedl out as "undef", and hey presto - I get a completely static build. I guess that the issue lies in Configure - either it's not detecting -Uusedl correctly, or it's deciding that it knows better and gives a dynamic build anyway.

        At any rate, I've now got my static build - thank you.

Re: static build of perl - how?
by Anonymous Monk on Dec 12, 2010 at 00:20 UTC
    There is now staticperl (http://staticperl.schmorp.de/), which is basically a shell script that builds fully static perls for you - it can even create a single perl binary with all modules (perl + xs) linked in.
Re: static build of perl - how?
by waswas-fng (Curate) on Jul 18, 2005 at 12:40 UTC
    You may want to leave out that you are using SCO software. Many people (like me) have given up supporting anything on that platform. SCO sells Linux when it is in their advantage, then sues IBM for it.


    -Waswas