Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install RMySQL on R 3.0.2 (ubuntu 14.04)

Tags:

mysql

r

ubuntu

so far i had this error;

Configuration error:
  could not find the MySQL installation include and/or library
  directories.  Manually specify the location of the MySQL
  libraries and the header files and re-run R CMD INSTALL.

INSTRUCTIONS:

1. Define and export the 2 shell variables PKG_CPPFLAGS and
   PKG_LIBS to include the directory for header files (*.h)
   and libraries, for example (using Bourne shell syntax):

      export PKG_CPPFLAGS="-I<MySQL-include-dir>"
      export PKG_LIBS="-L<MySQL-lib-dir> -lmysqlclient"

   Re-run the R INSTALL command:


      R CMD INSTALL RMySQL_<version>.tar.gz

2. Alternatively, you may pass the configure arguments
      --with-mysql-dir=<base-dir> (distribution directory)
   or
      --with-mysql-inc=<base-inc> (where MySQL header files reside)
      --with-mysql-lib=<base-lib> (where MySQL libraries reside)
   in the call to R INSTALL --configure-args='...' 

   R CMD INSTALL --configure-args='--with-mysql-dir=DIR' RMySQL_<version>.tar.gz

ERROR: configuration failed for package ‘RMySQL’
* removing ‘/home/samuel/R/x86_64-pc-linux-gnu-library/3.0/RMySQL’
Warning in install.packages :
  installation of package ‘./RMySQL_0.9-3.tar.gz’ had non-zero exit status

so i follow what it says at 1.

i input

export PKG_CPPFLAGS="-I</usr/include/mysql>"
export PKG_LIBS="-L</usr/lib/mysql> -lmysqlclient"

and then try again on the terminal to install with the command they give me

 R CMD INSTALL RMySQL_<version>.tar.gz

and i get;

checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I</usr/include/mysql>     -fpic  -O3 -pipe  -g  -c RS-DBI.c -o RS-DBI.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I</usr/include/mysql>     -fpic  -O3 -pipe  -g  -c RS-MySQL.c -o RS-MySQL.o
In file included from RS-MySQL.c:22:0:
RS-MySQL.h:32:19: fatal error: mysql.h: No existe el archivo o el directorio
 #include <mysql.h>
                   ^
compilation terminated.
make: *** [RS-MySQL.o] Error 1
ERROR: compilation failed for package ‘RMySQL’

so looking up i found this recommendations;

installing RMySQL gives error RS-MySQL.h:32:19: fatal error: mysql.h: No such file

and following what it says here:

http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

i don't get this step;

3. Edit or create the file Renviron.site and add the variable MYSQL_HOME which contains the location of your MySQL install. The file typically isn't created when installing R, so you may need to create it yourself. You will want to place it under the /etc directory in your R Home area. If you don't know where that is, you can issue R.home() at your R prompt. You will be adding a variable named MYSQL_HOME in variable=value syntax. Here's an example: Location of Renviron.site: C:/PROGRA~1/R/R-2.11~1.0/etc/Renviron.site Content is: MYSQL_HOME=C:/PROGRA~1/MySQL/MYSQLS~1.0/

because, when im in the Renviron.site, it doesn't let me edit on it anything, also i dont have clear what i should put there, anyway, i writte

MYSQL_HOME=C:/PROGRA~1/MySQL/MYSQLS~1.0/***

but i cant save it, it doesnt let me, because it says im not allowed, and i can't create a new file or anything there in /etc/

like image 919
Gotey Avatar asked Aug 18 '14 17:08

Gotey


1 Answers

For me I just needed to get the right package containing these files

sudo apt-get install libmysqlclient-dev
like image 143
ErichBSchulz Avatar answered Sep 28 '22 08:09

ErichBSchulz