我已經從Oracle下載ROracle 1.3-1.tar.gz
和Oracle即時客戶端12.2基本和devel rpms。獲取ROracle在ubuntu上運行
如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’
我試圖出口這些ENVIROMENTAL變量然後運行沒有參數的命令,但我是同樣的錯誤。
> 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
:
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
我也通過
echo "/usr/lib/oracle/12.2/client64/lib" | sudo tee /etc/ld.so.conf.d/oracle.conf
仍然寫在LD_LIBRARY_PATH
到conf文件所描述的here,試圖從Rstudio加載ROracle時,我得到以下錯誤
我設置了一個從libclntsh.so.12.1到libclntsh.so.11.1到/usr/lib/oracle/12.2/client64/lib/
的synlink,但它在我看來像是RStudio在錯誤的地方尋找我的R - nam ely /usr/local/...
而不是usr/...
。 我該如何補救?
我也試着設置
export RSTUDIO_WHICH_R=/usr/bin/R
,但它並沒有幫助。
之間的差額(如果有的話),不幸的是,我仍然得到同樣的錯誤消息,因爲我和前面的命令一樣。 –
你可能沒有管理員權限。你可能希望使用'dyn.load('/ usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1')'在R中明確加載它,即共享對象的路徑。然後運行'install.packages('ROracle')' – chinsoon12
感謝您的幫助。我確實有管理員權限,但問題似乎在其他地方。當我像你說的那樣,R說:「配置:錯誤:找不到OCI庫」 –