例如,在尝试安装 R 包时 curl
作为 usethis
的依赖项:
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.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=...'
R 检测到我没有安装 libcurl。这个外部部门在什么级别?指定的?我知道可以在描述文件中指示外部依赖项,并且确实 curl 的 pkg 描述文件确实包含:
SystemRequirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).
但是那一行是什么允许 R 检测丢失的依赖项并打印该错误?不可能吧?怎么可能?那么,R 是怎么做的呢?
最佳答案
简要地:
SystemRequirements
进行估算。在 DESCRIPTION
brew
或 apt
.这很好,但它也不适用于 CRAN 源代码级别。 configure
的可执行文件。测试资源是否存在,如果不存在则以明确的错误中止。 configure
is here . 关于r - 安装 R 包时,R 如何检查系统外部依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58291674/