Sorry for the prolix post; see tl;dr at the end.
I'm running macOS Catalina. I'm trying to install some packages in R (4.0.3) running in Rstudio (1.3.1093), but I keep oscillating between two different errors, both having to do with openssl.
I understand that the openssl that R wants to install is a wrapper for the system library of the same name. When I try to install, say, openssl, in Rstudio, I get the following error:
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/local/include
--------------------------- [ANTICONF] --------------------------------\
Configuration failed because openssl was not found. Try installing:\
\* deb: libssl-dev (Debian, Ubuntu, etc)\
\* rpm: openssl-devel (Fedora, CentOS, RHEL)\
\* csw: libssl_dev (Solaris)\
\* brew: openssl@1.1 (Mac OSX)\
If openssl is already installed, check that 'pkg-config' is in your\
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config\
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:\
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'\
-------------------------- [ERROR MESSAGE] ---------------------------\
tools/version.c:1:10: fatal error: 'openssl/opensslv.h' file not found\
#include <openssl/opensslv.h>\
1 error generated.
That's strange because when I go to the terminal and run \
which openssl
I get
/usr/bin/openssl
and when I run, also in the terminal,
locate opensslv.h
one of the items returned is
/usr/local/include/openssl/opensslv.h
Though it turns out that is a soft link which points to something I deleted. OK, so I change the soft link and have it point to another openssl/opensslv.h file elsewhere on my system (there sure are a lot of openssl packages on my system, mostly having to do with rails or anaconda). After that I try running
install.packages("openssl")
in Rstudio and this time I get a new error:
Error: package or namespace load failed for ‘openssl’ in dyn.load(file, DLLpath = DLLpath, ...):\
unable to load shared object '/usr/local/lib/R/4.0/site-library/00LOCK-openssl/00new/openssl/libs/openssl.so':\
dlopen(/usr/local/lib/R/4.0/site-library/00LOCK-openssl/00new/openssl/libs/openssl.so, 6): Symbol not found: _EVP_PKEY_get_raw_private_key\
Referenced from: /usr/local/lib/R/4.0/site-library/00LOCK-openssl/00new/openssl/libs/openssl.so\
Expected in: flat namespace\
in /usr/local/lib/R/4.0/site-library/00LOCK-openssl/00new/openssl/libs/openssl.so\
Error: loading failed\
Execution halted
If I do things more sensibly by installing openssl with brew and changing the opensslv.h soft link to point to the opensslv.h installed by brew, I get the same error when installing openssl in R (either in Rstudio or by running R in the terminal)
From what I've read online, that last R error (the package r namespace load failed one) has to do with multiple openssl versions on my system. And yes, I have a ton of openssl versions of my system (using locate and grep shows that I have 212 copies of openssl on my system) but the vast majority of those are from anaconda, ruby, or node, and the only one that looks like it's in my PATH is /usr/bin/openssl, which is read-only on later versions of macOS, btw.
So my question is A) Do I have too many versions of openssl in my PATH and B) how can I find them all?
Please don't judge my systems management; I've been doing stupid things trying to get these R packages installed and now I'm afraid I've dug a hole too deep to climb out of!
tl;dr: If I have multiple versions of a systems library (e.g. openssl) installed in my PATH in macOS, how can I find where they all are? Maybe something like linux's
ldconfig -p|grep openssl