【问题标题】:Error installing RMySQL (MySQL 5.5.37 in Ubuntu 14.04 )安装 RMySQL 时出错(Ubuntu 14.04 中的 MySQL 5.5.37)
【发布时间】:2014-09-07 10:43:45
【问题描述】:

每次我尝试安装 RMySQL 时都会收到以下错误:

Installing package into ‘/home/ehsan/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... yes
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql/mysql.h     -fpic  -O3 -pipe  -g  -c RS-DBI.c -o RS-DBI.o
cc1: warning: /usr/include/mysql/mysql.h: not a directory [enabled by default]
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql/mysql.h     -fpic  -O3 -pipe  -g  -c RS-MySQL.c -o RS-MySQL.o
cc1: warning: /usr/include/mysql/mysql.h: not a directory [enabled by default]
In file included from RS-MySQL.c:22:0:
RS-MySQL.h:32:19: fatal error: mysql.h: No such file or directory
 #include <mysql.h>
                   ^
compilation terminated.
make: *** [RS-MySQL.o] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/home/ehsan/R/x86_64-pc-linux-gnu-library/3.0/RMySQL’
The downloaded source packages are in
    ‘/tmp/RtmpTRRPqg/downloaded_packages’
Warning message:
In install.packages("RMySQL") :
  installation of package ‘RMySQL’ had non-zero exit status**

貌似找不到mysql.h,我搜索并更改了路径

导出PKG_CPPFLAGS="-I/usr/R/include/mysql/mysql.h"

但是没有成功。有很多人遇到过同样的问题,但他们的解决方案(如果存在)没有一个对我有用。如有任何意见或帮助,我将不胜感激。

#更新:问题已解决#

以下命令似乎解决了这个问题:

sudo apt-get install r-cran-rmysql

【问题讨论】:

  • 您可以编写自己的答案,而不是编辑“已解决的问题”
  • @RichardScriven,我更喜欢更紧凑的!
  • 好的。但我只是说即使你回答了自己的问题,人们有时也会支持你的答案。

标签: r ubuntu rmysql


【解决方案1】:

嗯,有两种类型的安装/制作问题。缺少 .h 文件和/或缺少 .so/.a 库。从日志中可以看出,您缺少 .h

原因是多方面的: 1.- 未安装提供这些的软件包。这意味着在 /usr 树中的任何地方都找不到这些文件。 解决方案是安装正确的包,确保文件在那里

2.- 安装配置器找不到包含。这意味着某些环境变量或安装选项设置不正确。通常在文档中指定要设置哪个变量;在某些情况下,您需要在 R 之外安装一些东西,这通常在文档中指定。

3.- 库不在 LD_LIBRARY_PATH 中,希望解决方案是不言自明的。

4.- 存在更深层次的编译/链接错误,这意味着软件包与软件的其余部分不兼容,或者没有正确移植。

【讨论】:

  • 谢谢,这说明了很多。
  • 当然,没问题。该解决方案实际上是基于我的 IT 副总裁发给我的一封电子邮件,该电子邮件涉及我在 Solaris HPC 集群上使用 R 时遇到的软件包安装问题。我从他的电子邮件中制作了一个 Evernote,我很高兴它在这里派上了用场。
【解决方案2】:

因为@ehsanmo 没有发布他的答案作为答案,那么我会,并确认他的解决方案也适用于我:

sudo apt-get install r-cran-rmysql

(我在薄荷 12)

【讨论】:

    【解决方案3】:

    如前所述,以下命令对我有用:

    sudo apt-get install r-cran-rmysql

    【讨论】:

    • 在 R studio 中安装 install 后就可以工作了
    【解决方案4】:

    我的这个问题通过执行以下命令得到解决:

    sudo apt-get install libmysql++-dev
    

    【讨论】:

      【解决方案5】:

      设置:1

      find / -name mysql.h
      

      如果找不到头文件丢失

      设置:1 然后安装或重新安装 mysql-devel 或 mysql-client

      sudo yum (re)install mysql-devel
      sudo yum (re)install mysql-client
      
      sudo yum (re)install mysql-community-devel
      sudo yum (re)install mysql-community-client
      

      【讨论】:

        猜你喜欢
        • 2014-01-25
        • 1970-01-01
        • 2017-08-27
        • 1970-01-01
        • 2016-05-30
        • 2014-08-14
        • 1970-01-01
        • 2019-10-11
        • 2016-09-10
        相关资源
        最近更新 更多