包'RMySQL'作为源包提供,但不是二进制包

时间:2014-06-15 12:42:48

标签: r macos install

我尝试安装此软件包时收到上述错误。阅读此问题install RMySQL for Mac我阅读了安装指南。

这里说的是什么:

During installation, RMySQL looks for the MySQL headers and libraries
in the system directories.  If these are not installed in system-wide
directories (or if you want to use an alternate MySQL distribution),
you may specify which MySQL directory(ies) to use through one of the
following:

   1. The shell variables PKG_CPPFLAGS and PKG_LIBS (using Bourne shell)

       export PKG_CPPFLAGS="-I<include-dir>"
       export PKG_LIBS="-L<library-dir> -lmysqlclient"

       For instance, on some 64 systems (e.g., Linux) you may need to set

       export PKG_CPPFALGS="-I/usr/include/mysql"
       export PKG_LIBS="-L/usr/lib64/mysql -lmysqlclient"

我浏览过我的电脑,我不相信这些目录存在。

我之前已经在我的Mac上安装过XAMPP,并想知道自从XAMPP使用MySQL以来所需的目录是否在某处?

我可以在某处下载目录吗? 如何找到它们是否已经在我的电脑上?

export PKG_CPPFALGS="-I/usr/include/mysql"
export PKG_LIBS="-L/usr/lib64/mysql -lmysqlclient"

我不知道接下来要做什么?

1 个答案:

答案 0 :(得分:2)

如果您不介意通过Homebrew安装另一台MySQL服务器,我已在另一个帖子中发布了完整的解决方案:Installing RMySQL in mavericks


但是在你的情况下,我确实在XAMPP中找到了那些包含与通过Homebrew安装的那些必需的MySQL头文件和库文件的目录。

因此,您可以设置环境变量并以终端方式构建:

% export PKG_CPPFALGS="-I/Applications/XAMPP/xamppfiles/include"
% export PKG_LIBS="-L/Applications/XAMPP/xamppfiles/lib -lmysqlclient"
## RMySQL_x.x-x.tar is the source package you have manually downloaded
% R CMD INSTALL RMySQL_x.x-x.tar

或以RStudio方式:

> Sys.setenv(PKG_CPPFLAGS = "-I/Applications/XAMPP/xamppfiles/include")
> Sys.setenv(PKG_LIBS = "-L/Applications/XAMPP/xamppfiles/lib -lmysqlclient")
## It will automatically download the source package in the remote repo
> install.packages("RMySQL", type = "source")