在SUSE汤草上安装RMySQL时出现新错误



我在SUSE Tumbleweed 20210618上安装RMySQL时遇到了一个"新"问题。我以前让RMySQL工作过,但在项目之间,RMySQL神秘地从R.中消失了

现在,当我运行install.packages时,它错误地读取了我的mysql_config参数(如下所示(。从mysql_config信息(如下所示(中可以明显看出,两者并不匹配。

有没有办法"纠正"PKG_CFLAGS和PKG_LIBS的设置方式,使它们指向正确的位置?或者,是否还有其他问题导致这种情况持续下去?

谢谢。。。

这是我的"install.packages"运行:

Installing package into ‘/home/craig/R/x86_64-suse-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RMySQL_0.10.21.tar.gz'
Content type 'application/x-gzip' length 53075 bytes (51 KB)
==================================================
downloaded 51 KB
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
** using staged installation
Found mysql_config cflags and libs!
Using PKG_CFLAGS=-I/usr//usr/include/mysql -I/usr//usr/include/mysql/mysql
Using PKG_LIBS=-L/usr//usr/lib64/ -lmariadb
-----------------------------[ ANTICONF ]-----------------------------
Configure could not find suitable mysql/mariadb client library. Try installing:
* deb: libmariadbclient-dev | libmariadb-client-lgpl-dev (Debian, Ubuntu)
* rpm: mariadb-connector-c-devel | mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
If you already have a mysql client library installed, verify that either
mariadb_config or mysql_config is on your PATH. If these are unavailable
you can also set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------[ ERROR MESSAGE ]----------------------------
<stdin>:1:10: fatal error: mysql.h: No such file or directory
compilation terminated.
-----------------------------------------------------------------------
ERROR: configuration failed for package ‘RMySQL’
* removing ‘/home/craig/R/x86_64-suse-linux-gnu-library/4.1/RMySQL’
Warning in install.packages :
installation of package ‘RMySQL’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpvBirrZ/downloaded_packages’

我从mysql_config得到的信息是:

Copyright 2011-2020 MariaDB Corporation AB
Get compiler flags for using the MariaDB Connector/C.
Usage: mysql_config [OPTIONS]
Compiler: GNU 11.1.1
--cflags        [-I//usr/include/mysql -I//usr/include/mysql/mysql]
--include       [-I//usr/include/mysql -I//usr/include/mysql/mysql]
--libs          [-L//usr/lib64/ -lmariadb]
--libs_r        [-L//usr/lib64/ -lmariadb]
--libs_sys      [-lz -ldl -lm -lpthread -lssl -lcrypto]
--version       [10.5.5]
--cc_version    [3.1.12]
--socket        [/run/mysql/mysql.sock]
--port          [3306]
--plugindir     [-L/usr/lib64 -lmariadbprivate -lz -ldl -lm -lpthread -lssl -lcrypto]
--tlsinfo       [//usr/lib64/mysql/plugin/]
--variable=OpenSSL 1.1.1k
pkgincludedir  [//usr/include/mysql]
pkglibdir      [//usr/lib64]
pkgplugindir   [//usr/lib64/mysql/plugin/]
--privatelibs   [VAR  VAR is one of:]

请注意,install.packages命令中的PKG_CFLAGS正在错误地读取配置文件(例如,将其转换为-I/usr/include…,而不是-I//usr/include…(。

我尝试了许多排列,但通过下载适当的RMySQL找到了解决方案。。。tar.gz文件,然后执行以下操作:

> R CMD INSTALL --configure-vars='INCLUDE_DIR=/usr/include/mysql/mysql INCLUDE_DIR=/usr/include/mysql  LIB_DIR=/usr/lib64/ LIB=mariadb' RMySQL_0.10.21.tar.gz 

这导致:

* installing to library ‘/home/craig/R/x86_64-suse-linux-gnu-library/4.1’
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
** using staged installation
Found INCLUDE_DIR and/or LIB_DIR!
Using PKG_CFLAGS=-I/usr/include/mysql 
Using PKG_LIBS=-L/usr/lib64/ -lmysqlclient
** libs
rm -f RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c RMySQL-init.c -o RMySQL-init.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c connection.c -o connection.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c db-apply.c -o db-apply.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c driver.c -o driver.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c exception.c -o exception.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c fields.c -o fields.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c result.c -o result.o
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/include/mysql   -I/usr/local/include   -fpic  -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto  -c utils.c -o utils.o
utils.c: In function ‘RS_DBI_newEntry’:
utils.c:132:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
132 |   for(i = 0; i < length; i++)
|   ^~~
utils.c:137:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
137 |     return indx;
|     ^~~~~~
gcc -shared -L/usr/lib64/R/lib -flto=auto -o RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o -L/usr/lib64/ -lmysqlclient -L/usr/lib64/R/lib -lR
installing to /home/craig/R/x86_64-suse-linux-gnu-library/4.1/00LOCK-RMySQL/00new/RMySQL/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (RMySQL)

最新更新