2

我在 Mac 上运行 R 版本 3.5。当我尝试安装 OpenMx 时

install.packages("OpenMx")

它最终在一堆警告消息后失败。

起初,警告信息是

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

并发现这可以通过运行来处理

xcode-select --install

在终端上。

当我在安装 xcode 后尝试安装 OpenMx 时,

最后几行消息是:

optimize.c:35:15: warning: unused function 'f_bound' [-Wunused-function]
static double f_bound(int n, const double *x, void *data_)
              ^
optimize.c:51:15: warning: unused function 'f_noderiv' [-Wunused-function]
static double f_noderiv(int n, const double *x, void *data_)
              ^
optimize.c:57:15: warning: unused function 'f_direct' [-Wunused-function]
static double f_direct(int n, const double *x, int *undefined, void *data_)
              ^
optimize.c:79:21: warning: unused function 'initial_step' [-Wunused-function]
static nlopt_result initial_step(nlopt_opt opt, const double *x, double *step)
                    ^
optimize.c:101:12: warning: unused function 'finite_domain' [-Wunused-function]
static int finite_domain(unsigned n, const double *lb, const double *ub)
           ^
5 warnings generated.
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rpf/include" -I/usr/local/include   -fPIC  -Wall -g -O2  -c options.c -o options.o
gfortran   -fPIC  -g -O2  -c sadmvn.f -o sadmvn.o
make: gfortran: No such file or directory
make: *** [sadmvn.o] Error 1
ERROR: compilation failed for package ‘OpenMx’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/OpenMx’
Warning in install.packages :
  installation of package ‘OpenMx’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/f8/y98w5w9n3yz3sq2pthhw35xm0000gn/T/RtmpJtQ01E/downloaded_packages’

有没有办法来解决这个问题?

4

2 回答 2

2

install.packages("OpenMx") 应该只适用于 R 3.5 下的所有平台 您可能在 CRAN 完成为所有平台推出新的二进制构建之前尝试过。现在再试一次。

如果您想从源代码构建(不是必需的),您需要为CRAN提供的 R >= 3.4 安装整个 MacOS 工具链。

于 2018-04-27T13:05:03.513 回答
2

这是关键的错误信息:

make: gfortran: 没有这样的文件或目录

你需要安装一个gfortran编译器。您可以在此处找到编译器和下载/安装说明:https ://gcc.gnu.org/wiki/GFortranBinaries 。

(注意:此解决方案也是针对不同的 R 包提供的,请参见此处。)

于 2018-04-25T19:13:19.863 回答