簡體   English   中英

解決 Rstudio 中的 openssl 安裝錯誤

[英]Resolving openssl install error in Rstudio

對不起,冗長的帖子; 最后見 tl;博士。

我正在運行 macOS Catalina。 我正在嘗試在 Rstudio (1.3.1093) 中運行的 R (4.0.3) 中安裝一些軟件包,但我一直在兩個不同的錯誤之間搖擺不定,這兩個錯誤都與 Z50955D4B2031276ACZCA11

我了解到R要安裝的openssl是同名系統庫的封裝。 當我嘗試在 Rstudio 中安裝 openssl 時,我收到以下錯誤:

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. 

這很奇怪,因為當我 go 到終端並運行 \

which openssl

我明白了

/usr/bin/openssl

當我跑步時,也在終端中,

locate opensslv.h

退回的物品之一是

/usr/local/include/openssl/opensslv.h

雖然事實證明這是一個指向我刪除的內容的軟鏈接。 好的,所以我更改了軟鏈接並讓它指向我系統上其他地方的另一個 openssl/opensslv.h 文件(我的系統上肯定有很多 openssl 包,主要與 rails 或 anaconda 有關)。 之后我嘗試跑步

install.packages("openssl")

在 Rstudio 中,這次我收到了一個新錯誤:

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終端)

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看起來它在我的 PATH 中是 /usr/bin/openssl,它在更高版本的 macOS 上是只讀的,順便說一句。

所以我的問題是 A)我的 PATH 中是否有太多版本的 openssl 和 B)我怎樣才能找到它們?

請不要評判我的系統管理; 我一直在做一些愚蠢的事情,試圖安裝這些 R 軟件包,現在恐怕我已經挖了一個太深的洞而無法爬出來!

tl;dr:如果我在 macOS 的 PATH 中安裝了多個版本的系統庫(例如 openssl),我如何才能找到它們的位置? 也許像linux的

ldconfig -p|grep openssl

要定位 brew openssl,請在終端中使用echo $(brew --prefix openssl) ,然后使用 output 在 ~/.R/Makevars 文件中添加兩行,例如,如果命令是 /usr/146/D 的 Z78E6221F6393D1356/D openssl@1.1,添加

LDFLAGS=-L/usr/local/opt/openssl@1.1/lib
CPPFLAGS=-I/usr/local/opt/openssl@1.1/include

到您的 ~/.R/Makevars 文件。

要在 macOS Big Sur 中從源代碼編譯包,請在此處查看我的說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM