简体   繁体   English

通过bash文件在本地编译R时出错

[英]Error compiling R locally via bash file

I am trying to compile R locally using a bash file, but it fails and shows the following error: 我正在尝试使用bash文件在本地编译R,但是它失败并显示以下错误:

tar: command not found
cd: R-3.2.5: No such file or directory
./configure: No such file or directory
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.
R-3.2.5/lib64/R/bin/R: No such file or directory
sed: command not found
mv: command not found
tar: command not found

Bellow is the bash file I am submitting: 贝娄是我提交的bash文件:

#!/bin/bash
tar -xzvf R-3.2.5.tar.gz
cd R-3.2.5
./configure --prefix=$(pwd)
make
make install
cd ..
R-3.2.5/lib64/R/bin/R -e 'install.packages(c("BGLR"), 
repos="http://cran.cnr.berkeley.edu/", dependencies = TRUE)'
sed -i '/^R_HOME_DIR=/c R_HOME_DIR=$(pwd)/R' R-3.2.5/lib64/R/bin/R
mv R-3.2.5/lib64/R ./
tar -czvf R.tar.gz R/

When I run the same command lines directly on terminal it works fine, but when I try to run them using a bash file it fails. 当我直接在终端上运行相同的命令行时,它可以正常工作,但是当我尝试使用bash文件运行它们时,它将失败。

Does anyone have an idea how to make it work? 有谁知道如何使它起作用?

The bash instance used to run the script doesn't seem to have the $PATH variable correctly set, so it can't find tar and the other commands. 用于运行脚本的bash实例似乎没有正确设置$PATH变量,因此无法找到tar和其他命令。

Try replacing the 1st line with #!/bin/bash -l . 尝试用#!/bin/bash -l替换第一行。 Add echo Path: $PATH as the 2nd line and see if one of the directory listed actually contains tar. 添加echo Path: $PATH作为第二行,并查看列出的目录之一是否实际包含tar。 You should get something like /bin:/sbin:/usr/bin/ . 您应该得到类似/bin:/sbin:/usr/bin/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM