title: R Packages, gcc, and BLAS on Amazon EC2
body: <p>I am trying to install RTextTools for R on my Amazon EC2 instance.  I'm using R 3.1.1. (installed 2014-07-10) with Amazon's Linux AMI.  I open R with root privileges and try the following:</p>
  
  <pre><code>&gt; install.packages('RTextTools')
  Installing package into ‘/root/R/x86_64-redhat-linux-gnu-library/3.1’
  (as ‘lib’ is unspecified)
  also installing the dependencies ‘slam’, ‘tm’, ‘maxent’
  
  trying URL 'http://cran.stat.ucla.edu/src/contrib/slam_0.1-32.tar.gz'
  Content type 'application/x-tar' length 46672 bytes (45 Kb)
  opened URL
  ==================================================
  downloaded 45 Kb
  
  trying URL 'http://cran.stat.ucla.edu/src/contrib/tm_0.6-1.tar.gz'
  Content type 'application/x-tar' length 510444 bytes (498 Kb)
  opened URL
  ==================================================
  downloaded 498 Kb
  
  trying URL 'http://cran.stat.ucla.edu/src/contrib/maxent_1.3.3.1.tar.gz'
  Content type 'application/x-tar' length 395873 bytes (386 Kb)
  opened URL
  ==================================================
  downloaded 386 Kb
  
  trying URL 'http://cran.stat.ucla.edu/src/contrib/RTextTools_1.4.2.tar.gz'
  Content type 'application/x-tar' length 448187 bytes (437 Kb)
  opened URL
  ==================================================
  downloaded 437 Kb
  
  * installing *source* package ‘slam’ ...
  ** package ‘slam’ successfully unpacked and MD5 sums checked
  ** libs
  gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c apply.c -o apply.o
  gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c grouped.c -o grouped.o
  gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c sparse.c -o sparse.o
  gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c util.c -o util.o
  gcc -m64 -std=gnu99 -shared -L/usr/local/lib64 -o slam.so apply.o grouped.o sparse.o util.o -L/usr/lib64/R/lib -lRblas -lgfortran -lm -lquadmath -L/usr/lib64/R/lib -lR
  /usr/bin/ld: cannot find -lRblas
  collect2: error: ld returned 1 exit status
  make: *** [slam.so] Error 1
  ERROR: compilation failed for package ‘slam’
  * removing ‘/root/R/x86_64-redhat-linux-gnu-library/3.1/slam’
  ERROR: dependency ‘slam’ is not available for package ‘tm’
  * removing ‘/root/R/x86_64-redhat-linux-gnu-library/3.1/tm’
  ERROR: dependency ‘tm’ is not available for package ‘maxent’
  * removing ‘/root/R/x86_64-redhat-linux-gnu-library/3.1/maxent’
  ERROR: dependencies ‘tm’, ‘maxent’ are not available for package ‘RTextTools’
  * removing ‘/root/R/x86_64-redhat-linux-gnu-library/3.1/RTextTools’
  
  The downloaded source packages are in
      ‘/tmp/RtmpkiBUCd/downloaded_packages’
  Warning messages:
  1: In install.packages("RTextTools") :
    installation of package ‘slam’ had non-zero exit status
  2: In install.packages("RTextTools") :
    installation of package ‘tm’ had non-zero exit status
  3: In install.packages("RTextTools") :
    installation of package ‘maxent’ had non-zero exit status
  4: In install.packages("RTextTools") :
    installation of package ‘RTextTools’ had non-zero exit status
  </code></pre>
  
  <p>It appears that the problem is that there is no Rblas.  I have:</p>
  
  <ul>
  <li>Tried installing slam, tm, and maxent separately</li>
  <li>Confirmed gcc is installed</li>
  <li>Installed other R packages (Zelig, ggplot2) with no problem</li>
  <li>Read <a href="https://stackoverflow.com/questions/14865976/r-packages-fail-to-compile-with-gcc">these</a> <a href="https://stackoverflow.com/questions/16710047/usr-bin-ld-cannot-find-lnameofthelibrary?lq=1">SO</a> <a href="https://stackoverflow.com/questions/3373995/usr-bin-ld-cannot-find-lz?lq=1">questions</a>.</li>
  <li>Tried to understand <a href="http://cran.r-project.org/doc/manuals/r-release/R-admin.html#BLAS" rel="nofollow noreferrer">enter link description here</a>the R documentation on BLAS</li>
  </ul>
  
  <p>I think the problem is R looking for a different version of BLAS than gcc uses.  But I really  have no idea.  I would prefer not to have to reinstall R, as it is under heavy use on the server.</p>
  
  <p>What do I do?</p>