Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac M1 Homebrew Perl Carton Net::SSLeay is loading libcrypto in an unsafe way

I'm trying to install Net::SSLeay with Carton. The installation fails with this message

Configuring Net-SSLeay-1.90 Running Makefile.PL Do you want to run external tests? 
These tests *will* *fail* if you do not have network connectivity. [n] n 
*** Found LibreSSL-2.8.3 installed in /usr 
*** Be sure to use the same compiler and options to compile your OpenSSL, perl, and Net::SSLeay. Mixing and matching compilers is not supported. 
Checking if your kit is complete... Looks good 
WARNING: /opt/homebrew/Cellar/perl/5.32.1_1/bin/perl is loading libcrypto in an unsafe way -> N/A

I've tried this with system perl, brew perl and multiple perlbrew perls. Google came up with a temp solution to build homebrew using x86_64 architecture. This did work for the libcrypto error, but gave me a whole different set of issues including mysql not running anymore.

Other "solutions" that I've tried are symlinking libssl & libcrypto as suggested by numerous other posts, all sadly without success.

Any ideas how to fix this or work around this without having to reinstall all brew packages as x86_64 ?

Quick Workaround

If you are looking for a quick workaround follow these steps.

  1. Run carton bundle to create a vendor cache directory.
  2. Go to cached tarball 'cache/authors/id/C/CH/CHRISN/' and unpack tar -xvzf Net-SSLeay-1.90.tar.gz
  3. Edit Makefile.PL, change my $prefix = find_openssl_prefix(); to my $prefix = '/opt/homebrew/opt/[email protected]'; ** adjust to your openssl location.
  4. Save and create new tarball tar -czvf Net-SSLeay-1.90.tar.gz Net-SSLeay-1.90
  5. Run carton install --cached to use the altered version

Hope this helps anyone in search of workaround

like image 536
Ryuuro Avatar asked Dec 23 '22 15:12

Ryuuro


2 Answers

You can solve this in two steps:

  • upgrade ExtUtils::MakeMaker to at least version 7.58 (e.g. cpanm ExtUtils::MakeMaker)
  • install openssl via macports (sudo port install openssl) or homebrew (brew install --cask openssl)
like image 145
Ether Avatar answered May 03 '23 03:05

Ether


After the Monterey update this broke again also on the x86_64 architecture, but just symlinking your latest openssl (where ever it is, depending how you have installed it) seemed to fix this. Example:

$ export OPENSSL_PREFIX=[find your openssl installation]
$ sudo ln -s $OPENSSL_PREFIX/lib/libssl.dylib /usr/local/lib/
$ sudo ln -s $OPENSSL_PREFIX/lib/libcrypto.dylib /usr/local/lib/
like image 34
Ade Avatar answered May 03 '23 03:05

Ade