【问题标题】:New Error installing RMySQL on SUSE Tumbleweed在 SUSE Tumbleweed 上安装 RMySQL 的新错误
【发布时间】:2021-09-05 08:23:51
【问题描述】:

我在 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//usr/include... 而不是 -I//usr/include... )。

【问题讨论】:

    标签: mysql r linux mariadb rmysql


    【解决方案1】:

    我尝试了很多排列,但通过下载适当的 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)
    

    【讨论】:

      猜你喜欢
      • 2018-12-19
      • 1970-01-01
      • 2011-07-25
      • 2013-05-05
      • 1970-01-01
      • 2012-03-15
      • 2016-01-30
      • 1970-01-01
      • 2014-08-14
      相关资源
      最近更新 更多