title: Installing kernlab package from sources on Mac
body: <p>I am on mavericks 10.9.2 and running R 3.0.2:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Let us try to install the kernlab package from source (not doing from source had worse errors)</p>
  
  <pre><code>install.packages("kernlab", type="source")
  </code></pre>
  
  <p>We get pretty far in compiling but at the end the <strong>linker</strong> fails:</p>
  
  <pre><code>-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
  </code></pre>
  
  <p><strong>UPDATE</strong> 
  Per Comments I updated to latest (3.12) R.  I also did a </p>
  
  <pre><code>brew install gfortran
  </code></pre>
  
  <p>which was successful</p>
  
  <p>But compiling R from source still has issues with -lgfortran:</p>
  
  <pre><code>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’
  </code></pre>
  
  <p>The XCode is 5.1.1 (updated just now - that is newest available for 10.9.2) </p>
  
  <p>Here is info on command line tools:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Here is gfortran info:</p>
  
  <pre><code>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)
  </code></pre>