2017-08-21 54 views
1

我已經從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 

,但它並沒有幫助。

回答

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
+0

之間的差額(如果有的話),不幸的是,我仍然得到同樣的錯誤消息,因爲我和前面的命令一樣。 –

+0

你可能沒有管理員權限。你可能希望使用'dyn.load('/ usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1')'在R中明確加載它,即共享對象的路徑。然後運行'install.packages('ROracle')' – chinsoon12

+0

感謝您的幫助。我確實有管理員權限,但問題似乎在其他地方。當我像你說的那樣,R說:「配置:錯誤:找不到OCI庫」 –

0

安裝ROracle是在爲一個真正的痛苦。我發現工作得很好的是,不會在每個安裝命令前加上sudo,而是先切換到超級用戶sudo su,然後以超級用戶身份執行整個安裝。我不是Linux專家,所以我不能真正告訴你爲什麼這是更穩定的方式。但它對我們有用。

我們還增加了一個bash文件oracle.sh/etc/profile.d/

預言。SH

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

謝謝,我試過了,但是我仍然得到和以前一樣的錯誤 –

+0

我們用這個命令來安裝ROracle ''''''R CMD INSTALL --configure-args =' - with-oci-lib =/usr/lib/oracle /12.1/client64/lib --with-oci-inc =/usr/include/oracle/12.1/client64'ROracle_1.3-1.tar.gz' –

+0

我也是(見上),只有12.2而不是12.1。 –

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檢查。在執行上述命令之前,它返回錯誤。

我不知道什麼是之前(check here)提到oracle.conforacle-instantclient.conf