获取ROracle在ubuntu上运行

时间:2017-08-21 13:22:41

标签: r roracle

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

this post所述,我执行了以下命令:

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

我已经按照here描述的LD_LIBRARY_PATH通过

写了echo "/usr/lib/oracle/12.2/client64/lib" | sudo tee /etc/ld.so.conf.d/oracle.conf
> 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

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

/usr/lib/oracle/12.2/client64/lib/

我在/usr/local/...设置了从libclntsh.so.12.1到libclntsh.so.11.1的同步链接,但我觉得RStudio正在寻找错误位置的R - 即usr/...而不是export RSTUDIO_WHICH_R=/usr/bin/R import img from 'imageURL' 。 我该如何解决这个问题?

我也尝试过设置

state = {
      img1: img
}

render(){

    const imgSize = { width: 100vw, height: 100vh }

    return(

        <div><img src={this.state.img1} style={imgSize}/></div>

    )
}

但它也没有帮助。

4 个答案:

答案 0 :(得分:0)

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

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

请注意缺少$LD_LIBRARY_PATH

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

  1. ROracle not working in R studio
  2. failing to load ROracle: unable to load shared object ROracle.so: libclntsh.so.11.1 No such file or directory

答案 1 :(得分:0)

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

我们还向oracle.sh

添加了一个bash文件/etc/profile.d/

<强> oracle.sh

LD_LIBRARY_PATH="/usr/lib/oracle/12.1/client64/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH

答案 2 :(得分: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.confcheck here)和oracle-instantclient.conf

之间的差异(如果有的话)

答案 3 :(得分: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