我已经从 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
但这也无济于事。