在OS X上安装RMySQL时出错

时间:2013-05-10 17:33:37

标签: mysql macos r osx-mountain-lion rmysql

我遇到了在OS X上安装RMySQL软件包的问题。软件包安装似乎有效,但是在测试软件包加载时,它总是会失败:

* 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’

可在此gist上找到完整的安装日志。

这似乎与在32位与64位模式下运行R有关。我已经通读并尝试了其中的所有内容无济于事:

系统信息:

  • R 2.15.2
  • OS X 10.8.3(Mountain Lion)
  • MySQL 5.1.45
  • XCode 3.2

2 个答案:

答案 0 :(得分:3)

在2月的R-sig-Mac列表中查看Simon Urbanek的这份备忘录:

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

“啊,等等 - 你在Mountain Lion上,你可能已经安装了R的32位默认值,因为当时支持的64位系统列表中省略了10.8 - 尝试安装最新的R 2.15.3 RC从 http://r.research.att.com/

您还应该确保RMySQL版本适用于版本2.15,因为CRAN现在将提供一个期望R 3.0.0正在运行的版本。实际上这应该不是问题,因为RMySQL_0.9-3位于UCB CRAN镜像的2.15二进制中继中:http://cran.cnr.berkeley.edu/bin/macosx/leopard/contrib/2.15/RMySQL_0.9-3.tgz

答案 1 :(得分:3)

我刚刚找到了解决这个问题的方法。我的R版本是

>  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

我需要做的就是将libmysqlclient lib复制到R lib目录。

您可以找到分步指南herehere