compile Perl as a STATIC library

T

Torsten Mohr

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.
 
B

Ben Morrow

Torsten Mohr said:
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
 
S

Sisyphus

Torsten said:
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
 
T

Torsten Mohr

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.
 
B

Ben Morrow

Torsten Mohr said:
Hi,


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
 
T

Torsten Mohr

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.
 
T

Torsten Mohr

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.
 
S

Sisyphus

Torsten said:
Hi,




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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top