Mac上的R El Capitan找不到float.h

时间:2016-03-06 22:16:08

标签: c++ r macos libraries install.packages

我将操作系统升级到El Capitan,现在我在R中发布了一个安装包命令     install.packages( 'MASS') 我收到以下错误:

/usr/local/Cellar/r/3.2.3/R.framework/Resources/include/R_ext/Constants.h:33:10: fatal error: 'float.h' file not found
#include <float.h>  /* Defines the rest, at least in C99 */

我的标准c ++库中有float.h:

ls /usr/include/c++/4.2.1/tr1/float.h 
/usr/include/c++/4.2.1/tr1/float.h

但是R是由家庭酿造安装的,正在看酒窖。

我认为El Capitan的路径在R中没有正确链接,所以我卸载了R,并重新安装了它。现在,当我尝试安装旧R安装的软件包(如ggplot2)时,我收到此错误。我看过很多关于El Capitain打破开发者工具的帖子(比如这个:https://ohthehugemanatee.org/blog/2015/10/01/how-i-got-el-capitain-working-with-my-developer-tools/),但没有任何关于R的内容。

这是El Capitan的R或家酿的问题吗?有没有办法告诉R在哪里寻找这些标题?任何其他建议也会非常有用。

install.packages('MASS')的完整输出如下:

trying URL 'https://cran.mtu.edu/src/contrib/MASS_7.3-45.tar.gz'
Content type 'application/x-gzip' length 487555 bytes (476 KB)
==================================================
downloaded 476 KB

* installing *source* package ‘MASS’ ...
** package ‘MASS’ successfully unpacked and MD5 sums checked
** libs
clang -I/usr/local/Cellar/r/3.2.3/R.framework/Resources/include -DNDEBUG -I/usr/local/include  -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/op
In file included from MASS.c:18:
In file included from /usr/local/Cellar/r/3.2.3/R.framework/Resources/include/R.h:44:
/usr/local/Cellar/r/3.2.3/R.framework/Resources/include/R_ext/Constants.h:33:10: fatal error: 'float.h' file not found
#include <float.h>  /* Defines the rest, at least in C99 */
         ^
1 error generated.
make: *** [MASS.o] Error 1
ERROR: compilation failed for package ‘MASS’
* removing ‘/usr/local/lib/R/3.2/site-library/MASS’

The downloaded source packages are in
    ‘/private/var/folders/rh/s75d4lws0fsg2xvw6jfj7sxw0000gp/T/Rtmp9lGxZ6/downloaded_packages’
Warning message:
In install.packages("MASS") :
  installation of package ‘MASS’ had non-zero exit status

编辑:42指出CRAN的R版本比brew更好。我卸载了R(brew uninstall R)并从CRAN(http://cran.us.r-project.org)下载并安装了R,现在可以使用了。

Edit2:在评论中,hrbrmstr指出,在El Capitan升级之后,home-brew需要一个干净的安装。我没有尝试过这种方法,但我想指出它可能会起作用。

0 个答案:

没有答案