pp (perl compiler) issue - still has a dependency

201 views Asked by At

I'm trying to use pp (the perl compiler) to create an application that can run independent of the perl installed library and interpreter.

It successfully creates a compiled executable although I had to use the -x -c options to get it to find dependencies successfully. It will run on my machine but when I try it on another machine I get this error so clearly there is still some dependency:

501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)

I am running it on MacOS 10.14.1 if that makes any difference. Thanks!

2

There are 2 answers

4
ikegami On

LWP::Protocol::https is loaded dynamically when needed, so pp has no way of knowing it's needed by default.

Solution 1

Pass -x to pp, and make sure the module is actually loaded in the run pp uses to determine the modules to include. This would probably be achieved by using LWP to make an HTTPS request during that run. --xargs=... might come in useful for this.

Solution 2

Pass -M LWP::Protocol::https to pp. You could also pass -M 'LWP::Protocol::**' to get all protocols handlers you have installed.

Solution 3

Add use LWP::Protocol::https (); to your script or an included module. Including a comment indicating why you are doing this would be appropriate.

0
clamp On

You were building Net::SSLeay on MacOS 10.14 linking it to libssl.44.dylib which is not present on MacOS 10.12 where you try to run it.

I've found it annoying having to switch between build and test systems to find out which of the libraries are missing or incompatible and need to be packed.

I am now using the following strategy:

  1. I use perlbrew instead of system perl.
  2. For alien dependencies I use homebrew instead of the system libraries.
  3. I build the packed executable using pp and run the resulting program with export DYLD_PRINT_LIBRARIES=YES being set (on the development machine)
  4. I examine the list of loaded libraries and add all those referenced in the homebrew directory tree (/usr/local/opt/ and /usr/local/cellar/in my case) using pp -l /full/path/name -l ...
  5. I rebuild the executable.

I still check on a target machine before deploying, but chances are very high now that it just works.