使用备用 GCC 构建 R 包 [英] Building R Packages using Alternate GCC

查看:26
本文介绍了使用备用 GCC 构建 R 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的系统在/usr/local/bin/gcc 中有 GCC 4.5(实验性),这已被证明对某些 R 包有问题.我想在/usr/bin/gcc 中使用系统 GCC.

The systems I work with have GCC 4.5 (experimental) in /usr/local/bin/gcc which has proven to be problematic for some R packages. I would like to instead use system GCC in /usr/bin/gcc.

我曾尝试在 Bash 配置文件(.bashrc、.bash_profile 等)以及命令行中设置 CC 和 CXX,但尽管 Bash 识别出更改,但 R 不识别.

I have tried setting CC and CXX in the Bash configuration files (.bashrc, .bash_profile etc.) as well as on the command line, but although Bash recognizes the change, R does not.

如何让 R 使用/usr/bin 中的 GCC 版本而不是/usr/local/bin/中的 GCC?

How can I get R to use the version of GCC in /usr/bin instead of the one in /usr/local/bin/?

推荐答案

这不是很好的文档(例如,我现在无法在R 扩展"或R 管理"中找到它)但是 Brian Ripley 提到了它几次在名单上.

This is not that well documented (e.g. I failed to locate it in either 'R Extension' or 'R Admin' right now) but Brian Ripley mentioned it a few times on the lists.

基本上,在 R 编译时,设置被注册并存储在 $R_HOME/etc/Makeconf 中.一种可能性是直接编辑该文件,但您可能没有 root 权限或可能不想影响所有其他用户.所以最好是创建

Basically, at R compile time, settings are registered and the stored in $R_HOME/etc/Makeconf. One possibility is to edit that file directly, but you may not have root privileges or may not want to affect all other users. So the better may be to create

~/.R/Makevars

有条目

CC=gcc-4.4
CXX=g++-4.4

加上您要设置的任何优化标志等.这将影响您运行的 R CMD INSTALLR CMD check 或 ... 的所有后续使用.

plus whichever optmisation flags etc you want to set. That will the affect all subsequent uses of R CMD INSTALL or R CMD check or ... that you run.

$R_HOME/etc/ 中的其他文件同样可以从 ~/.R/ 本地覆盖.

Other files in $R_HOME/etc/ can similarly be overridden locally from ~/.R/.

这篇关于使用备用 GCC 构建 R 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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