tokuhirom / plenv

Perl binary manager
Other
512 stars 70 forks source link

no backend configured for scheme https #163

Open faelin opened 4 years ago

faelin commented 4 years ago

Perl: 5.30.0 OS: Mac OS X (Mojave) 10.14.6 plenv 2.2.0 (maybe??? see #162)

plenv or modules that it depends on seem to be having issues. My primary concern is that plenv seems to be unable to use https to contact the cpan servers.

❯ plenv install -l
Available versions:
No backend configured for scheme https at /usr/local/Cellar/perl-build/1.30/libexec/lib/perl5/CPAN/Perl/Releases/MetaCPAN.pm line 48.

❯ plenv install 5.26.0
Installing 5.26.0 as 5.26.0
/Users/flandy/.plenv/versions/5.30.0/bin/perl5.30.0 -- /usr/local/Cellar/perl-build/1.30/libexec/bin/perl-build --symlink-devel-executables --build-dir /Users/flandy/.plenv/build/1578604819.43159/ --tarball-dir /Users/flandy/.plenv/cache/ -Dversiononly 5.26.0 /Users/flandy/.plenv/versions/5.26.0
Fetching 5.26.0 as /Users/flandy/.plenv/cache/perl-5.26.0.tar.gz (https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/perl-5.26.0.tar.gz)
No backend configured for scheme https at /usr/local/Cellar/perl-build/1.30/libexec/lib/perl5/Perl/Build.pm line 133.
ABORT
faelin commented 4 years ago

UPDATE: rm -rf $(plenv root) && brew reinstall plenv has fixed the issue for now. However, this means I will have to reinstall every perl version that I want, and all relevant modules.

douglasdd commented 4 years ago

"system" perl has correctly configured httpS support, but if you've switched to another plenv version, you'll need to install https support for that version:

  1. plenv install-cpanm
  2. cpanm Mozilla::CA
  3. cpanm LWP
  4. cpanm LWP::Protocol::https
bcc32 commented 4 years ago

Reinstalling plenv didn't work for me, but following @douglasdd's instructions did. I had to find where plenv had installed cpanm and manually run perl /usr/local/Cellar/perl/5.30.2_1/lib/perl5/site_perl/5.30.2/App/cpanminus/fatscript.pm instead of just plain cpanm.

abraxxa commented 3 years ago

Same issue here on Debian under WSL2 with a fresh installed plenv and perl-build.

gwerbin commented 3 years ago

I get this error when installing "fresh" on Mac (Mojave, 10.14.6) with Homebrew:

brew install cpanminus perl-build plenv
eval "$( plenv init )"
plenv install -l
Available versions:
No backend configured for scheme https at /usr/local/Cellar/perl-build/1.32/libexec/lib/perl5/CPAN/Perl/Releases/MetaCPAN.pm line 48.

The workaround by douglasdd fixes it, by installing those libraries to the "main" Homebrew-managed Perl that runs Plenv. - is this "official"? Maybe it should be part of the setup instructions, or Plenv should include it as some kind of setup script.

abbottmg commented 1 year ago

I get this error when installing "fresh" on Mac (Mojave, 10.14.6) with Homebrew:

I ran into the same issue while setting up a WSL environment with brew. Additionally, LWP::Protocol::https failed because its dependency Net::SSLeay needed two dev packages missing from my system, as discussed on PerlMonks.

The solution was, as noted in that thread, to run the following before re-attempting LWP::Protocol::https

sudo apt install libssl-dev
sudo apt install zlib1g-dev

I was still on system perl at the time within plenv.

EDIT: I spoke too soon. That still didn't allow plenv install -l or perl-build --definitions to work. There are two issues:

  1. The perl-build homebrew formula depends on the perl homebrew formula (rather than using the OS perl if available), and that version of perl does not come configured with the three packages mentioned by @douglasdd. It also doesn't install a matching version of cpanm (naturally) so the OS copy was happily installing modules elsewhere.
  2. I first attempted to resolve the above by setting up local::lib, which my OS cpanm wanted anyway. Unfortunately the perl-build wrapper script sets $PERL5LIB to its internal execlib without appending the old value. This meant it was never invoking perl with my local lib in @INC.

I'm not experienced enough with perl dependency management to know whether it's proper to include pre-existing values of $PERL5LIB; if not, perhaps the brew formula should be updated to use the self-contained distribution with all non-core dependencies bundled in? Or to remove the hard dependency on brew's perl and rely on the OS to have the right configuration. Which does seem to be the assumption upthread.

The perl formula strongly recommends local::lib because the Cellar's lib will get blown away upon upgrading, but doesn't enforce that. That probably disqualifies a third option to add cpanm as a brew dependency and invoke that to install the packages on installation. It probably also disqualifies appending old $PERL5LIB unless also adding a caveat doubling down on the importance of local::lib.

TL;DR: the final workaround was to run brew install cpanm, ensure local::lib was inactive just in case, and then pull those aforementioned packages into the Cellar's perl lib, after which perl-build functioned without needing to see my local::lib. I then confirmed that plenv install -l functions as expected both before and after enabling local::lib.

My goal today was to get self-contained perl libs from day one on my new machine so I didn't have to learn all the variables that go into locating a dependency. Oops 🤣

abbottmg commented 1 year ago

Actually, maybe the most foolproof option would be as follows:

  1. add cpanminus as a formula dependency
  2. During installation and upgrade, run that copy of cpanm -l ./libexec --self-contained Mozilla::CA LWP LWP::Protocol::https or
  3. cpan -l ./libexec --installdeps --self-contained .

That allows the project to pull the most up to date version of the deps at buildtime, prevents breaking when the perl formula upgrades, and avoids relying on the user following the local lib advice.