15

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

4

5 に答える 5

6

この問題は、次のコマンドを実行することで解決されました。

sudo apt-get install libmysql++-dev
于 2016-10-17T07:57:23.123 に答える
1

さて、インストール/作成の問題には 2 つのタイプがあります。欠落している .h ファイルおよび/または欠落している .so/.a ライブラリ。ログからわかるように、.h がありません。

これらの理由は複数あります: 1.- これらを提供するパッケージがインストールされていません。これは、これらのファイルが /usr ツリーのどこにも見つからないことを意味します。解決策は、正しいパッケージをインストールすることです。ファイルがそこにあることを確認してください

2.- インクルードは、インストール コンフィギュレーターによって検出されません。これは、一部の環境変数またはインストール オプションが正しく設定されていないことを意味します。どの変数を設定するかは、通常、ドキュメントで指定されています。場合によっては、R の外部に何かをインストールする必要がありますが、これは通常、ドキュメントで指定されています。

3.- ライブラリは LD_LIBRARY_PATH にありません。うまくいけば、その解決策は一目瞭然です。

4.- より深いコンパイル/リンク エラーがあります。これは、パッケージが SW の残りの部分と互換性がないか、適切に移植されていないことを意味します。

于 2014-07-16T19:24:52.003 に答える