2

我已经从 Oracle 下载ROracle 1.3-1.tar.gz了 Oracle 即时客户端 12.2 基本和开发 rpm。

本文所述,我执行了以下命令:

export ORACLE_HOME=/usr/lib/oracle/12.2/client64
sudo mkdir $ORACLE_HOME/rdbms
sudo mkdir $ORACLE_HOME/rdbms/public
sudo cp /usr/include/oracle/12.2/client64/* $ORACLE_HOME/rdbms/public

我尝试安装 ROracle

R CMD INSTALL --configure-args='--with-oci-lib=/usr/lib/oracle/12.2/client64/lib --with-oci-inc=/usr/include/oracle/12.2/client64'  ROracle_1.3-1.tar.gz

然后输出说

* installing to library ‘/home/s9970/R/x86_64-pc-linux-gnu-library/3.4’
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/oracle/12.2/client64     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rodbi.c -o rodbi.o
In file included from rodbi.c:182:0:
rodbi.c: In function ‘rodbiResBind’:
rodbi.h:43:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘sb8 {aka long int}’ [-Wformat=]
 # define _(String) (String)
                    ^
rodbi.c:200:36: note: in expansion of macro ‘_’
 #define RODBI_ERR_BIND_VAL_TOOBIG  _("bind value is too big(%lld), exceeds 2GB")
                                    ^
rodbi.c:2432:26: note: in expansion of macro ‘RODBI_ERR_BIND_VAL_TOOBIG’
         sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                          ^
rodbi.h:43:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘sb8 {aka long int}’ [-Wformat=]
 # define _(String) (String)
                    ^
rodbi.c:200:36: note: in expansion of macro ‘_’
 #define RODBI_ERR_BIND_VAL_TOOBIG  _("bind value is too big(%lld), exceeds 2GB")
                                    ^
rodbi.c:2469:26: note: in expansion of macro ‘RODBI_ERR_BIND_VAL_TOOBIG’
         sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                          ^
rodbi.c: In function ‘rodbiPlsqlResBind’:
rodbi.h:43:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘sb8 {aka long int}’ [-Wformat=]
 # define _(String) (String)
                    ^
rodbi.c:200:36: note: in expansion of macro ‘_’
 #define RODBI_ERR_BIND_VAL_TOOBIG  _("bind value is too big(%lld), exceeds 2GB")
                                    ^
rodbi.c:2816:28: note: in expansion of macro ‘RODBI_ERR_BIND_VAL_TOOBIG’
           sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                            ^
rodbi.h:43:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘sb8 {aka long int}’ [-Wformat=]
 # define _(String) (String)
                    ^
rodbi.c:200:36: note: in expansion of macro ‘_’
 #define RODBI_ERR_BIND_VAL_TOOBIG  _("bind value is too big(%lld), exceeds 2GB")
                                    ^
rodbi.c:2861:28: note: in expansion of macro ‘RODBI_ERR_BIND_VAL_TOOBIG’
           sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                            ^
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/oracle/12.2/client64     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c rooci.c -o rooci.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ROracle.so rodbi.o rooci.o -L/usr/lib/oracle/12.2/client64/lib -lclntsh -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lclntsh
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'ROracle.so' failed
make: *** [ROracle.so] Error 1
ERROR: compilation failed for package ‘ROracle’
* removing ‘/home/s9970/R/x86_64-pc-linux-gnu-library/3.4/ROracle’

我尝试导出这些环境变量,然后运行不带参数的命令,但我得到了同样的错误。

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH    
export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export OCI_LIB=/usr/lib/oracle/12.2/client64/lib
export LD_LIBRARY_PATH_64=/usr/lib/oracle/11.2/client6/lib:$LD_LIBRARY_PATH_64
R CMD INSTALL ROracle_1.3-1.tar.gz

我还通过这里LD_LIBRARY_PATH描述将其写入 conf 文件

echo "/usr/lib/oracle/12.2/client64/lib" | sudo tee /etc/ld.so.conf.d/oracle.conf

不过,尝试从 Rstudio 加载 ROracle 时出现以下错误:

> library(ROracle)
Loading required package: DBI
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/site-library/ROracle/libs/ROracle.so':
  libclntsh.so.11.1: cannot open shared object file: No such file or directory

我设置了一个从 libclntsh.so.12.1 到 libclntsh.so.11.1 的链接,/usr/lib/oracle/12.2/client64/lib/但在我看来,RStudio 正在错误的地方寻找我的 R - 即/usr/local/...而不是usr/.... 我该如何补救?

我也试过设置

export RSTUDIO_WHICH_R=/usr/bin/R

但这也无济于事。

4

4 回答 4

0
sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-
instantclient.conf" sudo ldconfig

描述于

https://github.com/oracle/node-oracledb/issues/453

为我工作。

我用了

dyn.load('/usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1')

在 R 中检查。在执行上述命令之前,它返回错误。

oracle.conf我想知道之前提到的(检查here)和有什么区别(如果有的话)oracle-instantclient.conf

于 2018-01-15T17:50:48.493 回答
0

根据 ROracle INSTALL文档,您应该使用

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH

注意缺少的$LD_LIBRARY_PATH.

安装后,您可能希望看到下面的加载包:

  1. ROracle 不在 R 工作室工作
  2. 无法加载 ROracle:无法加载共享对象 ROracle.so:libclntsh.so.11.1 没有这样的文件或目录
于 2017-10-03T01:16:40.800 回答
0

这解决了我的问题:

R CMD INSTALL --configure-args='--with-oci-lib=/usr/lib/oracle/19.3/client64/lib --with-oci-inc=/usr/include/oracle/19.3/client64' ../ROracle_1.3-1.tar.gz
于 2019-06-27T15:27:44.787 回答
0

安装 ROracle 真的很痛苦。我发现效果很好的不是sudo每个安装命令都预先设置,而是切换到超级用户,sudo su然后以超级用户身份执行整个安装。我不是 Linux 专家,所以我不能告诉你为什么这是一种更稳定的方式。但它对我们有用。

我们还添加了一个 bash 文件oracle.sh/etc/profile.d/

oracle.sh

LD_LIBRARY_PATH="/usr/lib/oracle/12.1/client64/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
于 2017-11-21T08:36:05.843 回答