"/bin/sh:XX:找不到命令"尝试从github安装R fst软件包的开发版本时出错 [英] "/bin/sh: XX: command not found" error when trying to install development version of R fst package from github

查看:156
本文介绍了"/bin/sh:XX:找不到命令"尝试从github安装R fst软件包的开发版本时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从github安装 fst软件包的开发版本. (我想要开发版本,因为它在保存数据帧时会维护列类,而当前发布的版本则不会.)

I'm trying to install the development version of the fst package from github. (I want the development version because it maintains column classes when saving data frames, whereas the current released version does not.)

最初,由于缺少OpenMP支持,安装失败.我按照步骤 此处 (适用于OSX上的R 3.4.0).

Initially, installation failed due to lack of OpenMP support. I resolved this (I think) by following the steps here for R 3.4.0 on OSX.

但是,现在出现以下错误:/bin/sh: XX: command not found.我已经在~/.R/Makevars文件中设置了应该设置的适当路径,所以我不确定下一步该如何解决该错误.

However, now I'm getting the following error: /bin/sh: XX: command not found. I've already set what are supposed to be the appropriate paths in the ~/.R/Makevars file, so I'm not sure what to do next to resolve the error.

这是我的代码和输出:

在添加OpenMP支持之前首先尝试安装fst

First attempt to install fst, before adding OpenMP support

devtools::install_github("fstPackage/fst", ref = "develop")

*正在安装* source *软件包"fst" ...
** libs
clang ++ -std = gnu ++ 11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -fopenmp -I. -Ifstcore -Ifstcore/LZ4 -Ifstcore/ZSTD -Ifstcore/ZSTD/common -Ifstcore/ZSTD/decompress -Ifstcore/ZSTD/compress -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/包括" -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fPIC -Wall -g -O2 -c FastStore.cpp -o FastStore.o
铛:错误:不支持的选项'-fopenmp'
make:*** [FastStore.o]错误1
错误:软件包"fst"的编译失败

* installing *source* package ‘fst’ ...
** libs
clang++ -std=gnu++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -fopenmp -I. -Ifstcore -Ifstcore/LZ4 -Ifstcore/ZSTD -Ifstcore/ZSTD/common -Ifstcore/ZSTD/decompress -Ifstcore/ZSTD/compress -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fPIC -Wall -g -O2 -c FastStore.cpp -o FastStore.o
clang: error: unsupported option '-fopenmp'
make: *** [FastStore.o] Error 1
ERROR: compilation failed for package ‘fst’

添加OpenMP支持

要添加OpenMP支持,我在此处 for R 3.4.0,包括从此处gfortran 6.1 >在此处中使用预先构建的OSX GUI安装程序.然后,按照指示,将以下内容添加到我的~/.R/Makevars文件中:

To add OpenMP support, I followed the steps here for R 3.4.0, including installing gfortran 6.1 from here and clang using the pre-built OSX GUI installer provided here. Then, as instructed, I added the following to my ~/.R/Makevars file:

CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++
CXX11=$CXX
CXX14=$CXX
CXX17=$CXX
CXX1X=$CXX
LDFLAGS=-L/usr/local/clang4/lib

第二次尝试安装fst

Second attempt to install fst

然后我再次运行安装代码并得到以下错误:

I then ran the installation code again and got the following error:

devtools::install_github("fstPackage/fst", ref = "develop")

*正在安装* source *软件包"fst" ...
** libs
XX -std = gnu ++ 11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -fopenmp -I. -Ifstcore -Ifstcore/LZ4 -Ifstcore/ZSTD -Ifstcore/ZSTD/common -Ifstcore/ZSTD/decompress -Ifstcore/ZSTD/compress -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/包括" -I/usr/local/include -fPIC -Wall -g -O2 -c FastStore.cpp -o FastStore.o
/bin/sh:XX:找不到命令
制作:*** [FastStore.o]
错误127错误:软件包"fst"的编译失败

* installing *source* package ‘fst’ ...
** libs
XX -std=gnu++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -fopenmp -I. -Ifstcore -Ifstcore/LZ4 -Ifstcore/ZSTD -Ifstcore/ZSTD/common -Ifstcore/ZSTD/decompress -Ifstcore/ZSTD/compress -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c FastStore.cpp -o FastStore.o
/bin/sh: XX: command not found
make: *** [FastStore.o]
Error 127 ERROR: compilation failed for package ‘fst’

除了错误,我还可以看到安装输出在第一次尝试中以clang++ -std=gnu++11 ...开头,在第二次尝试中以XX -std=gnu++11 ...开头.我猜想我需要告诉R(或其他程序)有关clang的路径,但是我不确定需要什么路径或将其放置在什么位置(不是Makevars文件应该照顾吗?),或者是否还需要解决其他问题.

In addition to the errors, I can see that the installation output begins with clang++ -std=gnu++11 ... in the first attempt and XX -std=gnu++11 ... in the second attempt. I'm guessing I need to tell R (or some other program) about the path to clang, but I'm not sure what path is needed or where to put it (and isn't the Makevars file supposed to take care of that?), or whether there are other issues that need to be fixed as well.

以下是有关我的系统的一些详细信息:

Here are some of the particulars about my system:

Macbook Pro,OSX Sierra(版本10.12.5)

Macbook Pro, OSX Sierra (version 10.12.5)

RStudio版本1.0.153

RStudio version 1.0.153

R会话信息

R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.5

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
 [1] httr_1.2.1      compiler_3.4.1  R6_2.2.2        tools_3.4.1     withr_1.0.2    
 [6] curl_2.8.1      memoise_1.1.0   git2r_0.19.0    digest_0.6.12   devtools_1.13.2

更新:基于@MarkPlotnick的评论,我将Makevars更改为以下内容:

UPDATE: Based on @MarkPlotnick's comment, I changed Makevars to the following:

CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++
CXX11=$(CXX)
CXX14=$(CXX)
CXX17=$(CXX)
CXX1X=$(CXX)
LDFLAGS=-L/usr/local/clang4/lib

这导致以下错误:

*正在安装 source 软件包"fst" ...
** libs/Users/eipi10/.R/Makevars:7:***递归变量"CXX"(最终)引用了自己.停止.
错误:软件包"fst"的编译失败

* installing source package ‘fst’ ...
** libs /Users/eipi10/.R/Makevars:7: *** Recursive variable `CXX' references itself (eventually). Stop.
ERROR: compilation failed for package ‘fst’

推荐答案

我遇到了这个问题,并根据

I ran into the issue and figured out the solution based on the comment by @Dirk in "/bin/sh: XX: command not found" error when trying to install development version of R fst package from github

我在.R/Makevars中明确设置了库:

I explicitly set the libraries in .R/Makevars:

CXX11=/usr/local/clang4/bin/clang++
CXX14=/usr/local/clang4/bin/clang++
CXX17=/usr/local/clang4/bin/clang++
CXX1X=/usr/local/clang4/bin/clang++

当我遇到此问题时,这对我有用,尽管在我的Mac上,二进制文件的路径为/Library/Developer/CommandLineTools/usr/bin/clang++)

This worked for me when I encountered this problem, though on my Mac the path to the binary is /Library/Developer/CommandLineTools/usr/bin/clang++)

这篇关于"/bin/sh:XX:找不到命令"尝试从github安装R fst软件包的开发版本时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆