Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing RMySQL on OS X

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:

  • RMySQL with 64-bit R on Mac OS X
  • RMySQL INSTALL instructions
  • INSTALLING 64 AND 32-BIT PACKAGES IN R ON A MAC

System information:

  • R 2.15.2
  • OS X 10.8.3 (Mountain Lion)
  • MySQL 5.1.45
  • XCode 3.2
like image 398
yoni Avatar asked May 10 '13 17:05

yoni


2 Answers

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

like image 149
IRTFM Avatar answered Nov 06 '22 20:11

IRTFM


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

like image 34
Lmwangi Avatar answered Nov 06 '22 22:11

Lmwangi