从Mac上的源安装kernlab包

时间:2014-11-06 15:58:28

标签: r macos

我在小牛10.9.2并且运行R 3.0.2:

20:35:19/Spectral $R

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)

让我们尝试从源代码安装kernlab软件包(不是从源代码那里做错了)

install.packages("kernlab", type="source")

我们在编译方面做得很好,但最后链接器失败了:

-Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [kernlab.so] Error 1
ERROR: compilation failed for package ‘kernlab’
* removing ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/kernlab’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.0/Resources/library/kernlab’

The downloaded source packages are in
    ‘/private/var/folders/k4/l5ww32y14svd5wmkgzzftl9m0000gn/T/RtmpyBfij3/downloaded_packages’
Warning message:
In install.packages("kernlab", type = "source") :
  installation of package ‘kernlab’ had non-zero exit status

更新 每条评论我更新到最新的(3.12)R。我也做了一个

brew install gfortran

这是成功的

但是从源代码编译R仍然存在-lgfortran:

的问题
install.packages("kernlab", type="source")
..
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [kernlab.so] Error 1
ERROR: compilation failed for package ‘kernlab’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/kernlab’

The downloaded source packages are in
    ‘/private/var/folders/k4/l5ww32y14svd5wmkgzzftl9m0000gn/T/RtmpugQtXD/downloaded_packages’

XCode是5.1.1(刚刚更新 - 最新可用于10.9.2)

以下是命令行工具的信息:

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 6.1.0.0.1.1413057044
volume: /
location: /
install-time: 1415295324
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group

这是gfortran信息:

09:54:46/spectral $gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gfortran/4.8.2/gfortran/libexec/gcc/x86_64-apple-darwin13.0.0/4.8.2/lto-wrapper
Target: x86_64-apple-darwin13.0.0
Configured with: ../configure --prefix=/usr/local/Cellar/gfortran/4.8.2/gfortran --datarootdir=/usr/local/Cellar/gfortran/4.8.2/share --bindir=/usr/local/Cellar/gfortran/4.8.2/bin --enable-languages=fortran --with-system-zlib --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl --disable-cloog-version-check --disable-isl-version-check --enable-checking=release --disable-stage1-checking --disable-libstdcxx --enable-lto --disable-nls --disable-multilib
Thread model: posix
gcc version 4.8.2 (GCC)

1 个答案:

答案 0 :(得分:0)

直接通过RStudio执行安装。目前尚不清楚为什么会产生差异,但问题已得到解决。