2

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 Answers2

2

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.

ikegami
  • 367,544
  • 15
  • 269
  • 518
  • Thanks for the response! I'd already done Solution 1 and then tried 2 and 3 and it still doesn't work. The error message I get is below but I think the upshot is there is compiled C code pulled in for https (like for Net::SSLeay) which is dependent on OS version. I'm running the code on MacOS 10.12. – user14352097 Sep 29 '20 at 12:03
  • Can't load '/var/folders/f8/h0j5ztxx46gc23w8vqr84nk40000gr/T/par-656d6d61/cache-8c87f8d504e251f65b1bc63c09c6b8d6ec227a9e/0a8a8e1e.bundle' for module Net::SSLeay: dlopen(/var/folders/f8/h0j5ztxx46gc23w8vqr84nk40000gr/T/par-656d6d61/cache-8c87f8d504e251f65b1bc63c09c6b8d6ec227a9e/0a8a8e1e.bundle, 1): Library not loaded: /usr/lib/libssl.44.dylib Referenced from: /var/folders/f8/h0j5ztxx46gc23w8vqr84nk40000gr/T//par-656d6d61/cache-8c87f8d504e251f65b1bc63c09c6b8d6ec227a9e/0a8a8e1e.bundle There's more but too long for a comment... – user14352097 Sep 29 '20 at 12:06
  • You may have used `-x` but that didn't mean you used solution 1 – ikegami Sep 29 '20 at 17:05
  • See the comment on the question – ikegami Sep 29 '20 at 17:06
1

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.

clamp
  • 2,552
  • 1
  • 6
  • 16