2014-07-16 45 views
14

每次我嘗試安裝RMySQL我得到以下錯誤:錯誤(在Ubuntu 14.04 MySQL的37年5月5日)在安裝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和我搜索,改變了路徑

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

但它沒有成功。有很多人有同樣的問題,但他們的解決方案(如果存在)沒有爲我工作。我會很感激任何評論或幫助。

更新:已解決的問題

下面的命令似乎解決了這個問題:

sudo apt-get install r-cran-rmysql

+0

您可以編寫自己的答案,而不是編輯「問題已解決」 –

+0

@RichardScriven,我更喜歡更緊湊的問題! –

+1

好的。但我只是說,即使你回答了你自己的問題,人們有時也會贊成你的答案。 –

回答

18

至於說,下面的命令爲我工作:

sudo apt-get install r-cran-rmysql

1

那麼,有兩種類型的安裝/製作的問題。缺少.h文件和/或缺少.so/.a庫。從日誌中可以看到,缺少一個.h

原因如下: 1.-未安裝提供這些功能的軟件包。這意味着這些文件不能在/ usr樹中的任何位置找到。 解決方案是安裝正確的包裝,確保文件存在

2.- 安裝配置程序找不到包含。這意味着某些環境變量或安裝選項未正確設置。通常在文檔中指定要設置的變量;在某些情況下,您需要在R之外再安裝一些,通常在文檔中指定。

3.-這些庫不在LD_LIBRARY_PATH中,希望解決方案是不言自明的。

4.-有一個更深的編譯/鏈接錯誤,這意味着軟件包與sw的其餘部分不兼容,或者沒有正確移植。

+0

謝謝,這澄清了很多。 –

+0

當然,沒問題。這個解決方案實際上是基於我的IT副總裁給我的一封電子郵件,內容是關於我在Solaris HPC集羣上使用R時遇到的軟件包安裝問題。我從他的電子郵件中創建了一個Evernote,我很高興它在這裏派上用場。 –

2

因爲@ehsanmo還沒有公佈他的回答作爲一個答案,那我會,並確認他的解決方案的工作對我來說:

sudo apt-get install r-cran-rmysql 

(我在薄荷12)

1

我這個問題是由執行以下命令來解決:

sudo apt-get install libmysql++-dev 
相關問題