不能 install/update 包 "rgl":包“rgl”的安装在 Windows 10 中具有非零退出状态

cannot install/update package "rgl": installation of package ‘rgl’ had non-zero exit status in Windows 10

我正在尝试将我的 rgl 从 0.103.5 版本更新到 0.104.16 版本。当我 运行 更新时,我收到以下错误消息:

    install.packages("rgl", dependencies = TRUE)
Installing package into ‘C:/Program Files/R/R-4.0.3’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
     binary   source needs_compilation
rgl 0.103.5 0.104.16              TRUE

installing the source package ‘rgl’

trying URL 'http://cran.rstudio.com/src/contrib/rgl_0.104.16.tar.gz'
Content type 'application/x-gzip' length 2832742 bytes (2.7 MB)
downloaded 2.7 MB

* installing *source* package 'rgl' ...
** package 'rgl' successfully unpacked and MD5 sums checked
** using staged installation
Configuring for R 4+ including OpenGL
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture

"C:/rtools40/mingw64/bin/"g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -Iext -Iext/ftgl -I/mingw64/include/freetype2 -DHAVE_PNG_H -DHAVE_FREETYPE -Iext         -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c ABCLineSet.cpp -o ABCLineSet.o
"C:/rtools40/mingw64/bin/"g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -Iext -Iext/ftgl -I/mingw64/include/freetype2 -DHAVE_PNG_H -DHAVE_FREETYPE -Iext         -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c BBoxDeco.cpp -o BBoxDeco.o
In file included from glgui.h:10,
                 from BBoxDeco.cpp:6:
ext/ftgl/FTGL/ftgl.h:32:10: fatal error: ft2build.h: No such file or directory
 #include <ft2build.h>
          ^~~~~~~~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-40~1.3/etc/x64/Makeconf:229: BBoxDeco.o] Error 1
ERROR: compilation failed for package 'rgl'
* removing 'C:/Program Files/R/R-4.0.3/rgl'
Warning in install.packages :
  installation of package ‘rgl’ had non-zero exit status

我通读了 Whosebug 中的类似错误,但无法解决我的问题。似乎错误可以追溯到 OpenGL 库,但是,我也不确定如何解决该问题。我的理解是 OpenGL 附带 OS,而不是单独的 R 库。任何 suggestions/directions 将不胜感激。

我的会话信息:

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13     magrittr_2.0.1      usethis_2.0.0       devtools_2.3.2      pkgload_1.1.0       githubinstall_0.2.2
 [7] R6_2.5.0            rlang_0.4.10        fansi_0.4.1         httr_1.4.2          tools_4.0.3         pkgbuild_1.2.0     
[13] data.table_1.13.6   xfun_0.20           sessioninfo_1.1.1   tinytex_0.28        cli_2.2.0           withr_2.3.0        
[19] remotes_2.2.0       ellipsis_0.3.1      assertthat_0.2.1    digest_0.6.27       rprojroot_2.0.2     lifecycle_0.2.0    
[25] crayon_1.3.4        processx_3.4.5      purrr_0.3.4         callr_3.5.1         fs_1.5.0            ps_1.5.0           
[31] testthat_3.0.1      curl_4.3            memoise_1.1.0       glue_1.4.2          compiler_4.0.3      desc_1.2.0         
[37] prettyunits_1.1.1   jsonlite_1.7.2 

rgl 的 Windows 版本假定 Freetype 可用,但在您的系统上找不到它。

rgl 的自述文件是这样说的:

BUILDING ON MICROSOFT WINDOWS

Install Rtools40 or newer.

Install Freetype via

pacman -S mingw-w64-{i686,x86_64}-freetype

Then the usual R CMD INSTALL should work.

或者,等待几天,二进制构建应该可以在 CRAN 上使用。