在 Windows 机器上的 Rstudio 中使用 install_github 安装包“cindex”时出错

问题描述

当我在 Rstudio 中运行命令 install_github("chrchang/plink-ng",subdir="/2.0/cindex") 时,我收到以下错误消息:

Downloading GitHub repo chrchang/plink-ng@HEAD
chrchang-plink-ng-b39d989/2.0/cindex/src/include: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\cindex\\src\\include'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/include: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\include'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/libdeflate: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\libdeflate'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pgenlib_ffi_support.cpp: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pgenlib_ffi_support.cpp'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pgenlib_ffi_support.h: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pgenlib_ffi_support.h'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pvar_ffi_support.cpp: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pvar_ffi_support.cpp'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/pvar_ffi_support.h: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\pvar_ffi_support.h'
chrchang-plink-ng-b39d989/2.0/pgenlibr/src/zstd: Can't create '\\\\?\\C:\\Users\\xxx\\AppData\\Local\\Temp\\Rtmp6PucTt\\remotes68581e00563b\\chrchang-plink-ng-b39d989\\2.0\\pgenlibr\\src\\zstd'
tar.exe: Error exit delayed from prevIoUs errors.
√  checking for file 'C:\Users\xxx\AppData\Local\Temp\Rtmp6PucTt\remotes68581e00563b\chrchang-plink-ng-b39d989\2.0\cindex/DESCRIPTION' ...
-  preparing 'cindex':
√  checking DESCRIPTION Meta-information ... 
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'cindex_0.2.tar.gz'
   
Installing package into ‘C:/Users/xxx/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'cindex' ...
** using staged installation
** libs
*** arch - i386
make: *** No rule to make target 'include/plink2_base.o',needed by 'cindex.dll'.  Stop.
ERROR: compilation Failed for package 'cindex'
* removing 'C:/Users/xxx/Documents/R/win-library/4.0/cindex'
错误: Failed to install 'cindex' from GitHub:
  (由警告转换成)installation of package ‘C:/Users/xxx/AppData/Local/Temp/Rtmp6PucTt/file685860d615b0/cindex_0.2.tar.gz’ had non-zero exit status
此外: Warning message:
In utils::untar(tarfile,...) :
  ‘tar.exe -xf "C:\Users\xxx\AppData\Local\Temp\Rtmp6PucTt\file68583f07ec.tar.gz" -C "C:/Users/xxx/AppData/Local/Temp/Rtmp6PucTt/remotes68581e00563b"’ returned error code 1*

解决方法

install_github() 在 Windows 10 R 上似乎不能正确处理 Git 符号链接。一种解决方法是克隆存储库并手动展开副本中的符号链接。