9

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
yoni
  • 5,686
  • 3
  • 27
  • 28
  • 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 May 10 '13 at 17:46
  • 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: http://marc.info/?l=r-sig-db&m=125563172023273 – yoni May 10 '13 at 18:39

2 Answers2

3

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

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • I actually used an RMySQL build built under R 2.15 AND the latest, and had the same results. However, your answer lead me to the right direction: migrate to R 3.0. Thank you very much for your help. :) – yoni May 10 '13 at 21:12
  • An alternative solution and just as a follower to the given question ;-) http://stackoverflow.com/questions/24537257/installing-rmysql-in-mavericks – Tin Jul 20 '14 at 16:48
3

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

Lmwangi
  • 2,486
  • 1
  • 19
  • 26
  • Thanks for the workaround, Lmwangi. Interesting that you ran into the same issue on R 3.0. For me, upgrading R to 3.0 solved the problem with no need to copy any libraries, since it seems that 32 vs. 64 bit support was the root cause. – yoni Oct 05 '13 at 15:18