【发布时间】:2014-07-16 12:44:20
【问题描述】:
我正在尝试为 R 安装 gsl 包,据我所知,它只是 OSX Mavericks 下 GSL 的一个包装器。我已经尝试了明显的:
> install.packages('gsl')
Installing package into ‘/Users/myusername/Library/R/3.1/library’
(as ‘lib’ is unspecified)
package ‘gsl’ is available as a source package but not as a binary
Warning in install.packages :
package ‘gsl’ is not available (for R version 3.1.0)
所以我跑了
> install.packages('gsl',type = 'source')
Installing package into ‘/Users/myusername/Library/R/3.1/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/gsl_1.9-10.tar.gz'
Content type 'application/x-gzip' length 342803 bytes (334 Kb)
opened URL
==================================================
downloaded 334 Kb
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘gsl’
* removing ‘/Users/myusername/Library/R/3.1/library/gsl’
Warning in install.packages :
installation of package ‘gsl’ had non-zero exit status
没有安装 GSL。哦!所以我通过 Homebrew 安装 GSL:
~ brew install gsl
==> Downloading http://ftpmirror.gnu.org/gsl/gsl-1.15.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gsl/1.15
==> make
==> make install
/usr/local/Cellar/gsl/1.15: 239 files, 6.7M, built in 101 seconds
再次尝试安装 R 包:
> install.packages('gsl',type = 'source')
Installing package into ‘/Users/myusername/Library/R/3.1/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/gsl_1.9-10.tar.gz'
Content type 'application/x-gzip' length 342803 bytes (334 Kb)
opened URL
==================================================
downloaded 334 Kb
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
checking for gsl-config... /usr/local/bin/gsl-config
checking if GSL version >= 1.12... checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: error: Need GSL version >= 1.12
ERROR: configuration failed for package ‘gsl’
* removing ‘/Users/myusername/Library/R/3.1/library/gsl’
Warning in install.packages :
installation of package ‘gsl’ had non-zero exit status
我显然是以错误的方式解决这个问题,但不确定问题到底出在哪里。
【问题讨论】:
-
我遇到了同样的问题。从 Homebrew 下载的 Mac OS 10.9.4、gcc 4.2.1、R 3.1.1 和 GSL 1.16。此外,文档 (gnu.org/software/gsl/manual/html_node/…) 中的示例程序可以毫无问题地编译(尽管我不知道如何运行/测试它,因为我对 C 一无所知)。
-
@RoyalTS。您似乎没有在 r-package 期望找到它的地方安装 GSL 包(不是 R-package gsl)。 (gnu.org/software/gsl)
-
@BondedDust 我已经通过自制软件安装了它,并且可以从命令行运行
gsl-config没有问题。我还尝试卸载自制版本并从头开始构建它,但无济于事。我收到相同的错误消息。包在哪里可以找到 GSL,我如何才能在安装过程中指向它的实际位置? -
我没有运行 Mavericks 或自制程序,但我在某些页面中读到您可能会在终端会话中将其与
launchctl setenv PATH "/usr/local/bin:$PATH"一起修补。 -
我认为这可能会奏效,尽管只有很多额外的胶带。如果您不介意,我会将整个过程放在答案中,看看它是否也适用于其他人。