簡體   English   中英

R 在安裝 R package 時如何檢查系統外部依賴項?

[英]How does R check for system external dependencies when installing an R package?

例如,在嘗試安裝 R package 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。 這個外部部門在什么級別。 指定的? 我知道可以在DESCRIPTION文件中指示外部依賴項,並且確實curl的pkgDESCRIPTION文件確實包含:

SystemRequirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).

但是這條線是什么讓 R 檢測到丟失的依賴項並打印該錯誤? 不可能吧? 怎么可能? 那么,R 是怎么做到的呢?

簡要地:

  1. 這都是在編寫 R Extension
  2. 簡而言之,它沒有,R 對您沒有幫助。 見下文。
  3. 可以聲明 CRAN(和 Bioconductor) package依賴項。
  4. 對於其他所有內容,您只能通過DESCRIPTION中的SystemRequirements進行近似
  5. 這不是一個已解決或可解決的問題,取決於所有操作系統
  6. 所以其他語言也沒有。
  7. 可以得到的是“垂直”堆棧中的 package 管理器——比如brewapt 這很好,但它在 CRAN 源代碼級別也不起作用。
  8. 因此,正如您所展示的,所有人所能做的就是調用名為configure的可執行文件來測試資源是否存在,如果不存在則以明確的錯誤中止。
  9. 對於您展示的 package, configure中的測試代碼在此處
  10. 還有一個兄弟Windows 版本

暫無
暫無

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

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