I worked out all of these recipes, step by step. Checked a lot of times that every condition is met:
My setup:
Windows XP 32bit
MySQL 5.5 server/client with all necessary lib and include files
PATH: C:\Program Files\R\R-2.12.2\bin\i386 ; C:\WINDOWS\system32 ; C:\WINDOWS ; C:\Progra~1\R\R-212~1.2\bin ; C:\Rtools\bin ; C:\Rtools\MinGW\bin
Still I am not able to even start compilation with R. RStudio gives me:
> install.packages('RMySQL', type ='source')
Installing package(s) into ‘C:/Documents and Settings/.../My Documents/R/win-library/2.12’
(as ‘lib’ is unspecified)
trying URL 'http://ftp5.gwdg.de/pub/misc/cran/src/contrib/RMySQL_0.9-3.tar.gz'
Content type 'application/x-gzip' length 165363 bytes (161 Kb)
opened URL
downloaded 161 Kb
>Warning in install.packages :
installation of package 'RMySQL' had non-zero exit status
>The downloaded packages are in
‘C:\Documents and Settings\...\Local Settings\Temp\RtmpZnaoz4\downloaded_packages’
R CMD is starting compilation, but then it suddenly fails. I had to add the path to the C:\Rtools\MinGW\bin
in the default windows path for R CMD to access gcc, although it is not mentioned in any of above recipes. I suspect that there's something going on with paths. Maybe R is not accessing Rtools or gcc or Rcmd, MySQL or something...
>C:\Documents and Settings\...\downloaded_packages>R CMD INSTALL RMySQL_*.tar.gz
>* installing to library 'C:\Documents and Settings\...\My Documents/R/win-library/2.12'
>* installing *source* package 'RMySQL' ...
>checking for $MYSQL_HOME... C:/PROGRA~1/MySQL/MYSQLS~1.5
>cygwin warning:
> MS-DOS style path detected: C:/PROGRA~1/MySQL/MYSQLS~1.5
> Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/MySQL/MYSQLS~1.5
> CYGWIN environment variable option "nodosfilewarning" turns off this warning.
> Consult the user's guide for more details about POSIX paths:
> http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
>** libs
>Warning: this package has a non-empty 'configure.win' file,
>so building only the main architecture
>cygwin warning:
> MS-DOS style path detected: C:/PROGRA~1/R/R-212~1.2/etc/i386/Makeconf
> Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-212~1.2/etc/i386/Makeconf
> CYGWIN environment variable option "nodosfilewarning" turns off this warning.
> Consult the user's guide for more details about POSIX paths:
> http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
>gcc -I"C:/PROGRA~1/R/R-212~1.2/include" -I"C:/PROGRA~1/MySQL/MYSQLS~1.5"/include >-O3 -Wall -std=gnu99 -c RS-DBI.c -o RS-DBI.o
>gcc -I"C:/PROGRA~1/R/R-212~1.2/include" -I"C:/PROGRA~1/MySQL/MYSQLS~1.5"/include >-O3 -Wall -std=gnu99 -c RS-MySQL.c -o RS-MySQL.o
>gcc -shared -s -static-libgcc -o RMySQL.dll tmp.def RS-DBI.o RS-MySQL.o C:/PROGRA~1/MySQL/MYSQLS~1.5/lib/opt/libmysql.lib -LC:/PROGRA~1/R/R-212~1.2/bin/i386 -lR
>installing to C:\Documents and Settings\...\My Documents/R/win-library/2.12/RMySQL/libs/i386
>** R
>** inst
>** preparing package for lazy loading
>Creating a new generic function for "format" in "RMySQL"
>Creating a new generic function for "print" in "RMySQL"
>** help
>*** installing help indices
>** building package indices ...
>** testing if installed package can be loaded
>MYSQL_HOME defined as C:/PROGRA~1/MySQL/MYSQLS~1.5
>Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
> call: dir(path = mysql, pattern = "^include$", include.dirs = TRUE,
> error: unused argument(s) (include.dirs = TRUE)
>ERROR: loading failed
>* removing 'C:\Documents and Settings\...\My Documents/R/win-library/2.12/RMySQL'