9
votes

I'm running into an issue installing the RMySQL package on OS X. Package installation seems to work, but when package loading is tested, it invariably fails:

* installing *source* package ‘RMySQL’ ...
. 
.(omitted for brevity. see the gist linked below for the full installation log)
.
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RMySQL/libs/i386/RMySQL.so':
  dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RMySQL/libs/i386/RMySQL.so, 6): Symbol not found: _mysql_affected_rows
  Referenced from: /Library/Frameworks/R.framework/Versions/2.15/Resources/library/RMySQL/libs/i386/RMySQL.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/2.15/Resources/library/RMySQL/libs/i386/RMySQL.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/RMySQL’

The full installation log can be found on this gist.

This seems to have something to do with running R in 32 bit vs. 64 bit mode. I've read through and tried everything in these to no avail:

System information:

  • R 2.15.2
  • OS X 10.8.3 (Mountain Lion)
  • MySQL 5.1.45
  • XCode 3.2
2
Do you have MySQL installed. It's not complaining about missing compilation tools, so I'm guessing that you have XCode installed (and just didn't tell us.)IRTFM
Great question. Yes, I have MySQL and Xcode installed (I just updated the system information accordingly). I also tried downloading the latest version of MySQL from oracle and explicitly using its lib and include paths, following instructions from here: marc.info/?l=r-sig-db&m=125563172023273yoni

2 Answers

3
votes

Take a look at this memo from Simon Urbanek on the R-sig-Mac list in February:

https://stat.ethz.ch/pipermail/r-sig-mac/2013-February/009967.html

"Ah, hold on - you are on Mountain Lion and you may have installed R with 32-bit default since 10.8 was omitted from the list of supported 64-bit systems at the time - try installing latest R 2.15.3 RC from http://r.research.att.com/"

You should also make sure that the RMySQL version is appropriate for version 2.15 since CRAN would now be serving up a version that expects R 3.0.0 to be running. Actually that should not be the problem since RMySQL_0.9-3 is in the 2.15 binaries trunk at the UCB CRAN mirror: http://cran.cnr.berkeley.edu/bin/macosx/leopard/contrib/2.15/RMySQL_0.9-3.tgz

3
votes

I just found a solution to this issue. My R version is

>  R.version          _
platform       x86_64-apple-darwin12.4.0
arch           x86_64
os             darwin12.4.0
system         x86_64, darwin12.4.0
status
major          3
minor          0.1
year           2013
month          05
day            16
svn rev        62743
language       R
version.string R version 3.0.1 (2013-05-16)
nickname       Good Sport

All I needed to do was copy the libmysqlclient lib to the R lib dir.

You can find a step by step guide here and here