f



compile Perl as a STATIC library

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.

0
Torsten
2/11/2004 10:17:40 PM
comp.lang.perl.misc 33233 articles. 2 followers. brian (1246) is leader. Post Follow

7 Replies
570 Views

Similar Articles

[PageSpeed] 39

Torsten Mohr <tmohr@s.netic.de> 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.    |   ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras.        |
0
Ben
2/11/2004 11:08:40 PM
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.

0
Sisyphus
2/12/2004 2:51:34 AM
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.

0
Torsten
2/13/2004 1:01:08 AM
Torsten Mohr <tmohr@s.netic.de> 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.me.uk
0
Ben
2/13/2004 2:52:59 AM
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.

0
Torsten
2/15/2004 4:15:17 PM
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.

0
Torsten
2/15/2004 4:18:31 PM
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.

0
Sisyphus
2/17/2004 12:58:44 AM
Reply: