Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Compiling C program with a Static Perl

by RonW (Parson)
on Sep 06, 2017 at 23:13 UTC ( #1198789=note: print w/replies, xml ) Need Help??


in reply to Compiling C program with a Static Perl

I need it that way for distribution purposes where no Perl or LibYAML can be installed

Is this a policy or technical limit?

If this a technical limit, then maybe a ZIP file could be used for distribution. The ZIP would contain your program, Perl and all the dependencies needed.

(If your situation requires an installer, there are ways to convert a ZIP file into an installer.)

(Although my primary PC runs Linux, I've only ever setup self-contained ZIP distributions for MS Windows, but this is possible with Linux, MacOS and others.)

For MS Windows, I have started with the portable edition of Strawberry Perl. After downloading and unzipping to a folder, go to that folder and run portableshell.bat

Then you can use the cpan command to install any dependencies from CPAN. You can copy any libraries your C program needs to the lib folder under the c folder.

Once you have your program running in this environment, make a copy of portableshell.bat to yourprogram.bat and customize yourprogram.bat to run your program. If you have several programs, you can make customized copies of portableshell.bat for each.

Test that your yourprogram.bat file(s) launch your program(s) correctly and everything is still running correctly.

Zip the folder containing yourprogram.bat and the dependencies. On a PC with without Perl or your program, unzip the zip file and test your program(s). If everything still works correctly, you now have a ZIP file to distribute.

  • Comment on Re: Compiling C program with a Static Perl

Replies are listed 'Best First'.
Re^2: Compiling C program with a Static Perl
by afoken (Abbot) on Sep 07, 2017 at 06:40 UTC

    If this a technical limit, then maybe a ZIP file could be used for distribution. The ZIP would contain your program, Perl and all the dependencies needed.

    (If your situation requires an installer, there are ways to convert a ZIP file into an installer.)

    See also Re: How do you distribute your Perl application to your customers?

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1198789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2019-05-20 00:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (123 votes). Check out past polls.

    Notices?