安装RMySQL时出错(在Ubuntu 14.04中为MySQL 5.5.37)

时间:2022-09-19 07:41:01

Every time I try installing RMySQL I get the following error:

每次我尝试安装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**

Seemingly, it cannot find mysql.h and I searched and changed the path to

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

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

export PKG_CPPFLAGS =“ - I / usr / R / include / mysql / mysql.h”

but it was not successful. There're many people who have had the same issue but non of their solutions (if existed) worked for me. I'd appreciate any comment or help.

但它没有成功。有很多人有同样的问题,但没有他们的解决方案(如果存在)为我工作。我很感激任何评论或帮助。

Update: Issue Resolved

The following command seemed to solve the issue:

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

sudo apt-get install r-cran-rmysql

sudo apt-get install r-cran-rmysql

4 个解决方案

#1


19  

As said, the following command worked for me:

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

sudo apt-get install r-cran-rmysql

sudo apt-get install r-cran-rmysql

#2


4  

My this issue was resolved by executing the following command:

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

sudo apt-get install libmysql++-dev

#3


2  

since @ehsanmo hasn't posted his answer as an answer, then I will, and confirm that his solution works for me too:

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

sudo apt-get install r-cran-rmysql

(I'm on mint 12)

(我在薄荷12)

#4


1  

Well, there are two types of install/make problems. Missing .h files and/or missing .so/.a libs. As you can see from your log, you have a missing .h

嗯,有两种类型的安装/制造问题。缺少.h文件和/或缺少.so / .a库。正如您从日志中看到的那样,您缺少.h

The reason for these are multiple: 1.- the package that delivers these is not installed. This means that those files cannot be found anywhere in the /usr tree. The solution is to install right package, make sure the files are there

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

2.- The includes are not found by the install configurator. This means some environment variable or install option is not properly set. Which variable to set is usually specified in the documentation; in some cases you need to install something outside of R and again, that's usually specified in the documentation.

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

3.- the libs are not in the LD_LIBRARY_PATH, and hopefully the solution to that is self-explanatory.

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

4.- There is a deeper compile/link error, meaning the package is not compatible with the rest of the sw, or has not been properly ported.

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

#1


19  

As said, the following command worked for me:

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

sudo apt-get install r-cran-rmysql

sudo apt-get install r-cran-rmysql

#2


4  

My this issue was resolved by executing the following command:

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

sudo apt-get install libmysql++-dev

#3


2  

since @ehsanmo hasn't posted his answer as an answer, then I will, and confirm that his solution works for me too:

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

sudo apt-get install r-cran-rmysql

(I'm on mint 12)

(我在薄荷12)

#4


1  

Well, there are two types of install/make problems. Missing .h files and/or missing .so/.a libs. As you can see from your log, you have a missing .h

嗯,有两种类型的安装/制造问题。缺少.h文件和/或缺少.so / .a库。正如您从日志中看到的那样,您缺少.h

The reason for these are multiple: 1.- the package that delivers these is not installed. This means that those files cannot be found anywhere in the /usr tree. The solution is to install right package, make sure the files are there

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

2.- The includes are not found by the install configurator. This means some environment variable or install option is not properly set. Which variable to set is usually specified in the documentation; in some cases you need to install something outside of R and again, that's usually specified in the documentation.

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

3.- the libs are not in the LD_LIBRARY_PATH, and hopefully the solution to that is self-explanatory.

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

4.- There is a deeper compile/link error, meaning the package is not compatible with the rest of the sw, or has not been properly ported.

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