Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

PAR::Packer, trouble to include specific external libraries

by HJO (Acolyte)
on Oct 01, 2012 at 15:18 UTC ( #996674=perlquestion: print w/ replies, xml ) Need Help??
HJO has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm trying to use PAR::Packer to package a perl script in a standalone binary file. My script is based on a module called sapnwrfc (http://search.cpan.org/~piers/sapnwrfc-0.36/sapnwrfc.pm), which purpose is to create external RFC connections to SAP systems. I use two different systems to test my scripts and my binary files : one(RHEL) which possess the module correctly installed so I can test my scripts and package them, and another(CentOS) which doesn't have the module so I can test the binary files that I made on the first system.

Here is my problem : This module works with a few lib files that I must add on the system I want to use the module for it to work, and I must specify in a environment variable the directory I placed them in... (the variable is called LD_LIBRARY_PATH)

Here is the command line I use to create the binary file :

 pp -o test --lib=/usr/sap/nwrfcsdk/lib/ -M Carp -M sapnwrfc SAP-NW-RFC_test.pl

At first I had an error because the lib weren't recognized by in the system :

Can't load '/tmp/par-726f6f74/cache-cc3f9bec3331e8f2e860f20be9bc3ebcaa +2a5e7d/8933ec24.so' for module SAPNW::Connection: libsapnwrfc.so: can +not open shared object file: No such file or directory at /usr/lib64/ +perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230. at /usr/lib/perl5/site_perl/5.8.8/PAR/Heavy.pm line 120 Compilation failed in require at sapnwrfc.pm line 22. BEGIN failed--compilation aborted at sapnwrfc.pm line 22. Compilation failed in require at script/SAP-NW-RFC_test.pl line 9. BEGIN failed--compilation aborted at script/SAP-NW-RFC_test.pl line 9.

Then I added the files in the usual directory on the system for the module to recognise them : /usr/sap/nwrfcsdk. But when I relaunched my binary file, I had another error :

Could not open the ICU common library. The following files must be in the path described by the environment variable "LD_LIBRARY_PATH": libicuuc.so.34, libicudata.so.34, libicui18n.so.34 [nlsui0_mt.c 154 +4] pid = 5485 LD_LIBRARY_PATH is currently set to /tmp/par-726f6f74/cache-cc3f9bec33 +31e8f2e860f20be9bc3ebcaa2a5e7d [nlsui0_mt.c 1547] pid = 5485

So I've got two questions :
  1. How can I change an environment variable at the runtime of the binary file
  2. How can I run my binary file whithout having a concern of the presence of this files in the system ? (I supposed I didn't had this problem because I was including the lib files on the beginning...)

Regards

Comment on PAR::Packer, trouble to include specific external libraries
Select or Download Code
Re: PAR::Packer, trouble to include specific external libraries
by Anonymous Monk on Oct 01, 2012 at 15:50 UTC

      Thank you for your answer,

      I used the --lib option which is an option that I believe alows me to add lib files to my package as specified on the doc :

      -I, --lib=DIR Add the given directory to the perl library file search path. May be specified multiple times. (http://search.cpan.org/~rschupp/PAR-Packer-1.013/lib/pp.pm)

      or do you mean that I have to include every single file with a -l option ?

      Thanks for cavapackager, I've heard of it but it didn't really seamed like the perfect answer for me... I'll give it another try tomorrow

      And yes basically CentOS is like RHEL, every packaged is compiled after the RedHat packages and it is supposed to be 100% compatible...

      Regards

        I used the --lib option ...

        That is why i said use the -l option, copy/paste and ctrl+f to read about the -l option

        $ perldoc pp |ack "\-l\b" -l, --link=*FILE*|*LIBRARY* packed file. Also accepts names under library paths; i.e. "-l ncurses" means the same thing as "-l libncurses.so" or "-l

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2014-08-20 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (105 votes), past polls