Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Resolving missing link to libcrypto/openssl on OSX
@lomse

This comment has been minimized.

Copy link

@lomse lomse commented Nov 1, 2018

Very helpful in solving this issue Blizzard/node-rdkafka#373. Thanks for sharing

@milapavlovic2018

This comment has been minimized.

Copy link

@milapavlovic2018 milapavlovic2018 commented Jan 15, 2019

Thank you, this solved the issue!

@oxfn

This comment has been minimized.

Copy link

@oxfn oxfn commented Jan 20, 2019

Unfortunately, this is not applicable for all cases that could occur. For example, symlinks to dynlibs are not enough for pkg-config to generate valid flags (I've faced this problem while trying to build go app). If we try to follow basic brew workflow and invoke brew link openssl it will explain, why it doesn't do this by default 🕵️‍♂️ an kindly suggest couple of solutions:

Warning: Refusing to link macOS-provided software: openssl
If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

Last option has worked well for me: PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" make build

@tostrowski

This comment has been minimized.

Copy link

@tostrowski tostrowski commented Feb 25, 2019

thanks!!

@stoicbuddha

This comment has been minimized.

Copy link

@stoicbuddha stoicbuddha commented Mar 14, 2019

Last option has worked well for me: PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" make build

@oxfn This worked like a charm! Thanks!

@LaRiffle

This comment has been minimized.

Copy link

@LaRiffle LaRiffle commented Apr 15, 2019

You're the best!

@finiteinfinity

This comment has been minimized.

Copy link

@finiteinfinity finiteinfinity commented Sep 23, 2019

Last option has worked well for me: PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" make build

Thanks so much!

@nepp-an

This comment has been minimized.

Copy link

@nepp-an nepp-an commented Apr 17, 2020

Unfortunately, this is not applicable for all cases that could occur. For example, symlinks to dynlibs are not enough for pkg-config to generate valid flags (I've faced this problem while trying to build go app). If we try to follow basic brew workflow and invoke brew link openssl it will explain, why it doesn't do this by default 🕵️‍♂️ an kindly suggest couple of solutions:

Warning: Refusing to link macOS-provided software: openssl
If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

Last option has worked well for me: PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" make build

thank you so much

@mawansui

This comment has been minimized.

Copy link

@mawansui mawansui commented May 5, 2020

Thank you so much for this!

@jhammerstein

This comment has been minimized.

Copy link

@jhammerstein jhammerstein commented May 6, 2020

Last option has worked well for me: PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" make build

when I do this, I get

make: *** No rule to make target `build'. Stop.

overall its very weird, because when i try to install openssl, it tells me that it already exists. However, when I try to use it it cant find it. I would be very grateful for help!!

@rlirli

This comment has been minimized.

Copy link

@rlirli rlirli commented May 12, 2020

brew install openssl installs the newest 1.1 version of openSSL.
Therefore the linking commands with libcrypto version 1.0.0 proposed above would not work.

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ should be
ln -s /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/lib/. However, this did not work for my use case either.


What did work was downgrading to openSSL 1.0 using @igormelao's code from this issue:

brew uninstall openssl 
brew uninstall openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

There are 2 uninstall commands to make sure any OpenSSL v1.1 is removed, and any dead v1.0 is removed, before installing v1.0.

@vcjuliocesar

This comment has been minimized.

Copy link

@vcjuliocesar vcjuliocesar commented May 18, 2020

hi,i have a problem, i need to install mongo in macos catalina,but it not work my code is this
sudo pecl install mongo
WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb"
downloading mongo-1.6.16.tgz ...
Starting to download mongo-1.6.16.tgz (210,341 bytes)
.............................................done: 210,341 bytes
118 source files, building
running: phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Build with Cyrus SASL (MongoDB Enterprise Authentication) support? [no] :
building in /private/tmp/pear/temp/pear-build-rootpBkTQl/mongo-1.6.16
running: /private/tmp/pear/temp/mongo/configure --with-php-config=/usr/local/opt/php@5.6/bin/php-config --with-mongo-sasl=no
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin19.4.0
checking host system type... x86_64-apple-darwin19.4.0
checking target system type... x86_64-apple-darwin19.4.0
checking for PHP prefix... /usr/local/Cellar/php@5.6/5.6.40
checking for PHP includes... -I/usr/local/Cellar/php@5.6/5.6.40/include/php -I/usr/local/Cellar/php@5.6/5.6.40/include/php/main -I/usr/local/Cellar/php@5.6/5.6.40/include/php/TSRM -I/usr/local/Cellar/php@5.6/5.6.40/include/php/Zend -I/usr/local/Cellar/php@5.6/5.6.40/include/php/ext -I/usr/local/Cellar/php@5.6/5.6.40/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php@5.6/5.6.40/pecl/20131226
checking for PHP installed headers prefix... /usr/local/Cellar/php@5.6/5.6.40/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable Mongo extension... yes, shared
checking Build with OpenSSL support... yes
checking for pkg-config... /usr/local/bin/pkg-config
checking for OpenSSL version... >= 0.9.6
checking for CRYPTO_free in -lcrypto... no
configure: error: libcrypto not found!
ERROR: `/private/tmp/pear/temp/mongo/configure --with-php-config=/usr/local/opt/php@5.6/bin/php-config --with-mongo-sasl=no' failed

help me pleace!

@rlirli

This comment has been minimized.

Copy link

@rlirli rlirli commented May 18, 2020

@vcjuliocesar Did you try downgrading your openSSL as I mentioned in the comment before:

brew uninstall openssl 
brew uninstall openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

There are 2 uninstall commands to make sure any OpenSSL v1.1 is removed, and any dead v1.0 is removed, before installing v1.0.

@avkermanov

This comment has been minimized.

Copy link

@avkermanov avkermanov commented May 26, 2020

@rlirli Thank you so much!This is it really the only solution helped me (for MacOS Catalina)

@vcjuliocesar Did you try downgrading your openSSL as I mentioned in the comment before:

brew uninstall openssl 
brew uninstall openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

There are 2 uninstall commands to make sure any OpenSSL v1.1 is removed, and any dead v1.0 is removed, before installing v1.0.

@jugatsu

This comment has been minimized.

Copy link

@jugatsu jugatsu commented Jun 11, 2020

brew uninstall --ignore-dependencies openssl
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb

ref: https://forums.meteor.com/t/mongodump-cannot-find-openssl-version-on-macos-catalina/50912/3

@mr-bat

This comment has been minimized.

Copy link

@mr-bat mr-bat commented Jun 18, 2020

brew uninstall --ignore-dependencies openssl
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb

ref: https://forums.meteor.com/t/mongodump-cannot-find-openssl-version-on-macos-catalina/50912/3

thanks!

@taozuhong

This comment has been minimized.

Copy link

@taozuhong taozuhong commented Jun 26, 2020

this command solve my problem on github CI job:
cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/

@anantonton

This comment has been minimized.

Copy link

@anantonton anantonton commented Jul 10, 2020

@vcjuliocesar Did you try downgrading your openSSL as I mentioned in the comment before:

brew uninstall openssl 
brew uninstall openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

There are 2 uninstall commands to make sure any OpenSSL v1.1 is removed, and any dead v1.0 is removed, before installing v1.0.

This is working for me!

@scalaview

This comment has been minimized.

Copy link

@scalaview scalaview commented Aug 22, 2020

I got another problem when I uninstall 1.1 after install 1.0.

ruby-2.6.5/lib/ruby/2.6.0/x86_64-darwin17/digest/sha1.bundle, 9): Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib

so I figure out to install both.

at first, cp the /usr/local/opt/openssl to /usr/local/Cellar/openssl/1.0.2t
then, uninstall 1.0 and reinstall 1.1.

brew uninstall openssl
brew install openssl@1.1

finally, link the old version to /usr/local/opt/openssl with below

ln -sf /usr/local/Cellar/openssl/1.0.2t /usr/local/opt/openssl
@jokumer

This comment has been minimized.

Copy link

@jokumer jokumer commented Oct 16, 2020

brew uninstall --ignore-dependencies openssl
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb

ref: https://forums.meteor.com/t/mongodump-cannot-find-openssl-version-on-macos-catalina/50912/3

Currently last command errors with
Error: Calling Installation of openssl from a GitHub commit URL is disabled! Use 'brew extract openssl' to stable tap on GitHub instead.

This worked for me

brew uninstall --ignore-dependencies openssl

Download https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb

brew install ./openssl.rb
@jzohrab

This comment has been minimized.

Copy link

@jzohrab jzohrab commented Nov 7, 2020

Thanks @jokumer, your solution works for Catalina 10.15.7:

brew uninstall --ignore-dependencies openssl
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb > openssl.rb
brew install ./openssl.rb
@hasibaasma

This comment has been minimized.

Copy link

@hasibaasma hasibaasma commented Nov 30, 2020

Thanks @jokumer, your solution works for Catalina 10.15.7:

brew uninstall --ignore-dependencies openssl
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb > openssl.rb
brew install ./openssl.rb

This worked for me! Thanks

@jokumer

This comment has been minimized.

Copy link

@jokumer jokumer commented Nov 30, 2020

I forgot that curl thing. Thx for contributing by comment

@will

This comment has been minimized.

Copy link

@will will commented Dec 29, 2020

working homebrew openssl postgres configure (just stuffing keywords for future searchers)

./configure prefix=/tmp/pg --with-openssl --with-libs=/usr/local/opt/openssl/lib --with-includes=/usr/local/opt/openssl/include

@lelodois

This comment has been minimized.

Copy link

@lelodois lelodois commented Jan 19, 2021

this command solve my problem on github CI job:
cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/

Me tooo thanks :)

@anantonton

This comment has been minimized.

Copy link

@anantonton anantonton commented Jan 27, 2021

@vcjuliocesar Did you try downgrading your openSSL as I mentioned in the comment before:

brew uninstall openssl 
brew uninstall openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

There are 2 uninstall commands to make sure any OpenSSL v1.1 is removed, and any dead v1.0 is removed, before installing v1.0.

This is working for me!

ANDDDDD... after accidentally upgraded openssl (and brew), this is no longer working for me. somehow.

But I find this working (no need to do the last step - brew switch... )

kelaberetiv/TagUI#635 (comment)

@jeromeof

This comment has been minimized.

Copy link

@jeromeof jeromeof commented Jan 28, 2021

Great work - but when I try the app (after giving it permission etc) - I get the following error popup:

Unable to load OpenSSL library files: libssl.1.1.dylib and libcrypto.1.1.dylib

@shahramsaghaei

This comment has been minimized.

Copy link

@shahramsaghaei shahramsaghaei commented Mar 23, 2021

If you are using a conda env, simply use

conda install -c bioconda samtools openssl=1.0
@arkakkar

This comment has been minimized.

Copy link

@arkakkar arkakkar commented Apr 8, 2021

thanks

@CrowleyRajapakse

This comment has been minimized.

Copy link

@CrowleyRajapakse CrowleyRajapakse commented Apr 22, 2021

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

when you perform this export commands in the terminal above issue got resolved for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment