compile Perl as a STATIC library

Discussion in 'Perl Misc' started by Torsten Mohr, Feb 11, 2004.

  1. Torsten Mohr

    Torsten Mohr Guest

    Hi,

    i downloaded, compiled and installed Perl successfully on Win32.
    I can now write programs that use the Perl interpreter to execute
    some scripts. That's just fine.

    But if i want to distribute this code to some other PCs, i need
    to install Perl there completely, not just the perl58.dll, but
    also the modules.

    Is there some way to compile Perl as a STATIC library that already
    includes all modules that come with a normal Perl installation?

    I looked into the Makefile, the Readme's, but didn't yet find
    any hint for this.

    I hope it is clear what i want, i want to compile a static Perl
    library and link it with my own programs so i can distribute them
    as standalone programs and i can execute Perl scripts in these
    programs.


    Thanks for any hints,
    Torsten.
     
    Torsten Mohr, Feb 11, 2004
    #1
    1. Advertising

  2. Torsten Mohr

    Ben Morrow Guest

    Torsten Mohr <> wrote:
    > But if i want to distribute this code to some other PCs, i need
    > to install Perl there completely, not just the perl58.dll, but
    > also the modules.
    >
    > Is there some way to compile Perl as a STATIC library that already
    > includes all modules that come with a normal Perl installation?
    >
    > I looked into the Makefile, the Readme's, but didn't yet find
    > any hint for this.
    >
    > I hope it is clear what i want, i want to compile a static Perl
    > library and link it with my own programs so i can distribute them
    > as standalone programs and i can execute Perl scripts in these
    > programs.


    If the 'programs' you are talking about are Perl programs, then you
    want PAR. If they are C programs that use embedded Perl interpreters,
    then you will want to build perl statically by passing -Uusedl to
    Configure, and then you must make sure you create an perlxsi.c with
    ExtUtils::Embed::xs_init and link it into your executable.

    Ben

    --
    Musica Dei donum optimi, trahit homines, trahit deos. |
    Musica truces molit animos, tristesque mentes erigit. |
    Musica vel ipsas arbores et horridas movet feras. |
     
    Ben Morrow, Feb 11, 2004
    #2
    1. Advertising

  3. Torsten Mohr

    Sisyphus Guest

    Torsten Mohr wrote:
    > Hi,
    >
    > i downloaded, compiled and installed Perl successfully on Win32.
    > I can now write programs that use the Perl interpreter to execute
    > some scripts. That's just fine.
    >
    > But if i want to distribute this code to some other PCs, i need
    > to install Perl there completely, not just the perl58.dll, but
    > also the modules.
    >


    If they're perl scripts, then use PAR to build them into executables and
    distribute those executables with the perl58.dll. (No need to distribute
    the modules as well.)

    > Is there some way to compile Perl as a STATIC library that already
    > includes all modules that come with a normal Perl installation?
    >


    I spent a few minutes googling for info on how to build a static perl on
    native win32 - also did a quick search of the ActiveState mailing list
    archives - and found nothing. Would you let me know if you come up with
    some info on how to achieve it ?

    It might be readily achievable with Cygwin - though I personally have no
    interest in following that route.

    Cheers,
    Rob

    --
    To reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Feb 12, 2004
    #3
  4. Torsten Mohr

    Torsten Mohr Guest

    Hi,

    > If the 'programs' you are talking about are Perl programs, then you
    > want PAR. If they are C programs that use embedded Perl interpreters,
    > then you will want to build perl statically by passing -Uusedl to
    > Configure, and then you must make sure you create an perlxsi.c with
    > ExtUtils::Embed::xs_init and link it into your executable.


    this sounds very interesting, thanks for that hint.
    I'd like to do this on WIN32, so i can't really pass anything
    to "configure", on Windows there's a Makefile for nmake.
    I will look into it and undef "USEDL", but i think there
    are more changes necessary.


    Thanks,
    Torsten.
     
    Torsten Mohr, Feb 13, 2004
    #4
  5. Torsten Mohr

    Ben Morrow Guest

    Torsten Mohr <> wrote:
    > Hi,
    >
    > > If the 'programs' you are talking about are Perl programs, then you
    > > want PAR. If they are C programs that use embedded Perl interpreters,
    > > then you will want to build perl statically by passing -Uusedl to
    > > Configure, and then you must make sure you create an perlxsi.c with
    > > ExtUtils::Embed::xs_init and link it into your executable.

    >
    > this sounds very interesting, thanks for that hint.
    > I'd like to do this on WIN32, so i can't really pass anything
    > to "configure", on Windows there's a Makefile for nmake.
    > I will look into it and undef "USEDL", but i think there
    > are more changes necessary.


    Get MinGW (http://www.mingw.org) and build it properly with Configure
    and make: it's a supported configuration on win32. (NB this is not the
    same as cygwin: the final perl.exe doesn't depend on any special dlls
    or POSIX emulation layers, only on MSVCRT.dll as ever.)

    Ben

    --
    don't get my sympathy hanging out the 15th floor. you've changed the locks 3
    times, he still comes reeling though the door, and soon he'll get to you, teach
    you how to get to purest hell. you do it to yourself and that's what really
    hurts is you do it to yourself just you, you and noone else *
     
    Ben Morrow, Feb 13, 2004
    #5
  6. Torsten Mohr

    Torsten Mohr Guest

    Hi,

    > If they're perl scripts, then use PAR to build them into executables and
    > distribute those executables with the perl58.dll. (No need to distribute
    > the modules as well.)


    That's the point, i don't want to ship an external perl58.dll, i
    want it as a static lib.

    On Linux i have a "libperl.a", why isn't this possible on Win32?


    Best regards,
    Torsten.
     
    Torsten Mohr, Feb 15, 2004
    #6
  7. Torsten Mohr

    Torsten Mohr Guest

    Hi,

    > Get MinGW (http://www.mingw.org) and build it properly with Configure
    > and make: it's a supported configuration on win32. (NB this is not the
    > same as cygwin: the final perl.exe doesn't depend on any special dlls
    > or POSIX emulation layers, only on MSVCRT.dll as ever.)


    Thanks for that hint. I tried it, but:

    "Configure -d -Uusedl" starts fine, asks for the C library, continues
    and at some point doesn't find some functions and then doesn't write
    a Makefile.  No way to continue...

    What could be the problem? I don't remember the names of the missing
    functions right now, i'll post them when i'm on that Win32 PC again.

    On Linux i have libperl.a, shouldn't this be possible on Win32?


    Thanks for hints,
    Torsten.
     
    Torsten Mohr, Feb 15, 2004
    #7
  8. Torsten Mohr

    Sisyphus Guest

    Torsten Mohr wrote:
    > Hi,
    >
    >
    >>If they're perl scripts, then use PAR to build them into executables and
    >>distribute those executables with the perl58.dll. (No need to distribute
    >>the modules as well.)

    >
    >
    > That's the point, i don't want to ship an external perl58.dll, i
    > want it as a static lib.
    >
    > On Linux i have a "libperl.a", why isn't this possible on Win32?
    >


    It's probably possible on Win32 - I just haven't heard of anyone having
    done it - which leads to me think it may well be quite difficult.

    I don't feel confident that *I* would be able to acieve this without
    step-by-step instructions.

    Perhaps someone on ActiveState's perl-win32-users mailing list can
    provide some assistance/advice .... or maybe someone on the PAR mailing
    list (though this is not really on-topic for either of those lists).

    Cheers,
    Rob


    --
    To reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Feb 17, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    572
    Chris Uppal
    Nov 17, 2005
  2. Nagaraj
    Replies:
    1
    Views:
    882
    Lionel B
    Mar 1, 2007
  3. Loic Mahe
    Replies:
    1
    Views:
    1,000
    Spoon
    Jun 8, 2007
  4. Replies:
    0
    Views:
    339
  5. Avi
    Replies:
    0
    Views:
    187
Loading...

Share This Page