无法使用 home-brew 和 r 4.1 在 Big Sur 上安装 rcurl

时间:2021-05-20 08:54:00

标签: r macos homebrew macos-big-sur rcurl

我正在尝试使用 Big Sur 和 R 4.1 在我的 macOS 上安装 RCurl。请参阅下面的输出 - 它不起作用。 我确实需要它,因为我需要 GenomeInfDB

有谁知道如何使用“命名空间”和 RCurl 解决这个问题?

非常感谢您的建议。

谢谢

砂光机

install.packages("RCurl")
Installing package into ‘/opt/homebrew/lib/R/4.1/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/RCurl_1.98-1.3.tar.gz'
Content type 'application/x-gzip' length 728630 bytes (711 KB)
==================================================
downloaded 711 KB

* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
** using staged installation
checking for curl-config... /Users/slaan3/anaconda3/bin/curl-config
checking for gcc... gcc

[我删除了一点,因为它不适合字符数...]

ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libcurl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libgssapi_krb5.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libxml2.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libicui18n.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libiconv.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libz.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libicudata.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Users/slaan3/anaconda3/lib/libicuuc.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
installing to /opt/homebrew/lib/R/4.1/site-library/00LOCK-RCurl/00new/RCurl/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RCurl’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/opt/homebrew/lib/R/4.1/site-library/00LOCK-RCurl/00new/RCurl/libs/RCurl.so':
  dlopen(/opt/homebrew/lib/R/4.1/site-library/00LOCK-RCurl/00new/RCurl/libs/RCurl.so, 6): Symbol not found: _curl_easy_cleanup
  Referenced from: /opt/homebrew/lib/R/4.1/site-library/00LOCK-RCurl/00new/RCurl/libs/RCurl.so
  Expected in: flat namespace
 in /opt/homebrew/lib/R/4.1/site-library/00LOCK-RCurl/00new/RCurl/libs/RCurl.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/opt/homebrew/lib/R/4.1/site-library/RCurl’

1 个答案:

答案 0 :(得分:1)

我在 macOS 上开发 R 包,强烈建议不要在 R 内的系统 PATH 中激活 conda。这会导致 R 选择 conda gcc,这与构建许多不兼容macOS 上的 R 包。看看 R for macOS Developers guide,它详细解释了这一点。或者,您可以使用 PATH 文件在 R 中专门设置 Renviron,这将有助于防止编译器与 conda gcc 混淆。

此外,从源代码构建软件包时,建议在 macOS 上使用 CRAN R binary 安装。不建议将通过 conda 提供的 R 版本用于在 macOS 上从源代码构建包。

这可以通过 Homebrew 安装:

brew install --cask r