在R:'stdlib.h'文件中安装软件包

时间:2018-10-23 16:46:45

标签: r package install stdio

我正在尝试从RStudio安装RMark。我注意到无法安装所需的软件包之一。似乎C有问题。您能帮我吗?

> install.packages('mvtnorm')
trying URL 'https://cran.rstudio.com/src/contrib/mvtnorm_1.0-8.tar.gz'
Content type 'application/x-gzip' length 159539 bytes (155 KB)
==================================================
downloaded 155 KB

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 
* installing *source* package 'mvtnorm' ...
** package 'mvtnorm' successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -I"/anaconda3/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/anaconda3/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/anaconda3/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix  -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
In file included from C_FORTRAN_interface.c:8:
In file included from ./mvtnorm.h:2:
/anaconda3/lib/R/include/R.h:55:11: fatal error: 'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in packages */
          ^~~~~~~~~~
1 error generated.
make: *** [/anaconda3/lib/R/etc/Makeconf:160: C_FORTRAN_interface.o] Error 1
ERROR: compilation failed for package 'mvtnorm'
* removing '/anaconda3/lib/R/library/mvtnorm'
Warning in install.packages :
  installation of package 'mvtnorm' had non-zero exit status

The downloaded source packages are in
	'/private/var/folders/5m/lbpq3yj53n7clgx4r1fy6blr0000gn/T/RtmppNGt3S/downloaded_packages'
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
> 

2 个答案:

答案 0 :(得分:1)

如果您尝试安装conda存储库中不存在的软件包,则还可以为Mojave安装所需的SDK标头

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Source

答案 1 :(得分:0)

您已经使用conda安装了R(我想是从路径上安装的),因此请使用conda procedures而不是install.packages()安装软件包。