title: Mac OS X R error "ld: warning: directory not found for option"
body: <p>I am trying to install an R package from source, but getting an error:</p>
  
  <pre><code>* installing *source* package ‘mclust’ ...
  ** package ‘mclust’ successfully unpacked and MD5 sums checked
  ** libs
  gfortran-4.8   -fPIC  -g -O2  -c mclust.f -o mclust.o
  gfortran-4.8   -fPIC  -g -O2  -c mclustaddson.f -o mclustaddson.o
  clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o mclust.so mclust.o mclustaddson.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
  ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
  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 -lquadmath
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [mclust.so] Error 1
  ERROR: compilation failed for package ‘mclust’
  * removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/mclust’
  Warning in install.packages :
    installation of package ‘mclust’ had non-zero exit status
  </code></pre>
  
  <p>I don't have <code>/usr/local/lib/gcc/x86_64-apple-darwin13.0.0</code>, so it makes sense that it can't be found. I have <code>/usr/local/lib/gcc/i686-apple-darwin11</code> and <code>/usr/local/lib/gcc/4.8</code> (symlink to Homebrew installation). Where is it getting <code>x86_64-apple-darwin13.0.0</code> from?</p>
  
  <p>There are a lot of references to a similar error online. However, all of them are related to compiling in Xcode and resolved by updating project settings, which is not applicable here.</p>