让ROracle在ubuntu上运行

让ROracle在ubuntu上运行,r,roracle,R,Roracle,我已经从Oracle下载了ROracle 1.3-1.tar.gz和Oracle instant client 12.2 basic和devel 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下载了ROracle 1.3-1.tar.gz和Oracle instant client 12.2 basic和devel 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文件,如通过

尽管如此,我在尝试从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
我在
/usr/lib/oracle/12.2/client64/lib/
处设置了一个从libclntsh.so.12.1到libclntsh.so.11.1的synlink,但在我看来,RStudio在错误的地方寻找我的R,即
/usr/local/..
而不是
usr/..
。 我该怎么补救呢

我也试过设置

export RSTUDIO_WHICH_R=/usr/bin/R
但是它也没有帮助。

根据ROracle文档,您应该使用

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH
请注意缺少的
$LD\u LIBRARY\u路径

安装后,您可能希望查看以下内容以加载软件包:


  • 安装ROracle在as中是一件非常痛苦的事情。我发现工作得很好的不是为每个安装命令预先添加
    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
    
    描述于

    为我工作

    我曾经

    dyn.load('/usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1')
    
    在R中检查。在执行上述命令之前,它返回错误

    我想知道前面提到的
    oracle.conf
    oracle instantclient.conf

    之间有什么区别(如果有),这解决了我的问题:

    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
    

    不幸的是,我仍然收到与上一个命令相同的错误消息。您可能没有管理员权限。您可能希望使用
    dyn.load('/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1')
    在R中显式加载它,即指向共享对象的路径。然后运行
    install.packages('ROracle')
    谢谢您的帮助。我确实有管理员权限,但问题似乎出在其他地方。当我按照你说的做时,R说“配置:错误:未找到OCI库”,你能分享更多关于配置错误的细节吗?您能否同时使用/usr/lib/oracle/12.2/client64/lib和/usr/lib/oracle/12.2/client64/lib中的libclntsh文件?再次感谢您的帮助。我在上面的问题中添加了lib信息。不幸的是,错误没有说明更多内容:
    *安装*source*包'ROracle'…**包“ROracle”成功解包并检查MD5总和配置:错误:未找到OCI库错误:包“ROracle”*配置失败删除“/home/[user]/R/x86_64-pc-linux-gnu-library/3.4/ROracle”
    谢谢,我尝试过,但我仍然会遇到与以前相同的错误,我们使用此命令安装ROracle
    R CMD install--configure args='--使用oci lib=/usr/lib/oracle/12.1/client64/lib--使用oci inc=/usr/include/oracle/12.1/client64'ROracle_1.3-1.tar.gz
    me(参见上文),仅使用12.2而不是12.1.1安装sqlplus客户端吗oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm`对于您来说可能是我现在做的12.2,我还添加了oracle.sh文件,但没有任何区别:/Welcome to StackOverflow!谢谢你的贡献。为了增加您的解决方案的价值,请提供一些上下文,说明您的解决方案工作的原因和方式。请花些时间看一下,特别是在部分。
    dyn.load('/usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1')
    
    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