6

So I can't load ROracle. I am indeed very new to this so any information is appreciated and any info regarding what further information to give would be helpful as well.

> library(ROracle)
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '~/R/x86_64-pc-linux-gnu-library/2.14/ROracle/libs/ROracle.so':
  libclntsh.so.11.1: cannot open shared object file: No such file or directory
Error: package/namespace load failed for ‘ROracle’

ROracle.so is exactly where it says it is. libclntsh.so.11.1 can be found at /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1. This is the result of .libPaths:

> .libPaths()
[1] "/home/nguiller/R/x86_64-pc-linux-gnu-library/2.14" "/usr/local/lib/R/site-library"                     "/usr/lib/R/site-library"                          
[4] "/usr/lib/R/library"                                "/usr/lib/rstudio/R/library" 

My .Renviron file

LD_LIBRARY_PATH="/usr/lib/oracle/11.2/client64/lib:/home/nguiller/Downloads/instantclient_11_2"
ORACLE_HOME="/usr/lib/oracle/11.2/client64/:/home/nguiller/Downloads/instantclient_11_2"
OCI_LIB="/usr/lib/oracle/11.2/client64/lib"

I had a lot of trouble installing ROracle to begin with due to OCI libraries but it eventually worked with R CMD INSTALL --configure-ags='--with-oci-lib=/usr/lib/oracle/11.2/client64/lib --with-oci-inc=/usr/include/oracle/11.2/client64' ROracle_1.1-8.tar.gz

Let me know how I can help.

Nils Guillermin
  • 1,867
  • 3
  • 21
  • 51

5 Answers5

1

ORACLE_HOME should point to just one location. Shouldn't you set LD_LIBRARY_PATH_64 variable?

igr
  • 3,409
  • 1
  • 20
  • 25
  • 1
    This worked after I exported the env variables (.Renviron doesn't seem to work). Thank you so much! `export LD_LIBRARY_PATH="/usr/lib/oracle/11.2/client64/lib:/home/nguiller/Downloads/instantclient_11_2" && export ORACLE_HOME="/usr/lib/oracle/11.2/client64/" && export OCI_LIB="/usr/lib/oracle/11.2/client64/lib" && export LD_LIBRARY_PATH_64="/usr/lib/oracle/11.2/client64/lib:/home/nguiller/Downloads/instantclient_11_2"` – Nils Guillermin Feb 14 '13 at 19:24
  • I have the exact same problem

    library(ORE) Loading required package: OREdm Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/usernamehere/R/x86_64-redhat-linux- gnu-library/3.2/ROracle/libs/ROracle.so': libclntsh.so.11.1: cannot open shared object file: No such file or directory Error: package ‘OREdm’ could not be loaded


    you make reference to instantclient_11_2 in the user dir . how did you get that there ... unsipped files ?
    – Madmartigan Dec 04 '15 at 05:42
  • @Madmartigan Check your installation (file is there...) and environment variables (library path(s) for your platform) – igr Dec 04 '15 at 08:45
  • cheers , I had a bloody typo..which I looked at so many times... your correct the LD_LIBRARY_PATH was the one that needed the instantclient_11_2 location... all good now ... happy days :) – Madmartigan Dec 04 '15 at 13:00
  • Heads up - on some linux distros you have to modify `LD_LIBRARY_PATH` in `/etc/ld.so.conf.d/*.conf` per [THIS](http://stackoverflow.com/questions/28025911/roracle-not-working-in-r-studio/36822521#36822521) post on SO. – Ian Jan 04 '17 at 19:57
0

If you really really really want to do this within the R environment, you can load the specific library as follows:

dyn.load("/usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1")
library(ROracle)

References:

Setting LD_LIBRARY_PATH from inside R

chinsoon12
  • 25,005
  • 4
  • 25
  • 35
-1

I got same error while loading "library(ORE)"

  Error in dyn.load(file, DLLpath = DLLpath, ...) :
      unable to load shared object '/usr/lib64/R/library/ROracle/libs/ROracle.so':
      libclntsh.so.11.1: cannot open shared object file: No such file or directory
    Error: package 'OREdm' could not be loaded

Looks like the shared object ROracle.so is referring to libclntsh.so.11.1 instead of libclntsh.so.12.1

bash-4.1$ pwd
/usr/lib64/R/library
bash-4.1$ grep -irsh "libclntsh.so.11.1" *
Binary file ROracle/libs/ROracle.so matches

As a work around, I have created a symlink, so that libclntsh.so.12.1 can be referred as libclntsh.so.11.1.

$ cd /scratch/softwares/R/db_instant_client/instantclient_12_1

 ln -s libclntsh.so.12.1 libclntsh.so.11.1

After this step, I am able to load library(ORE) successfully.

Please see my website for more details.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
  • 6
    Hello, and welcome to Stack Overflow. Please be careful when including links to your own sites or blogs -- you should always disclose your affiliation. See [How not to be a spammer](https://stackoverflow.com/help/promotion) for detailed guidance. – tripleee Jun 28 '17 at 07:38
-1

set $LD_LIBARARY_PATH=$ORACLE_HOME/lib

-1

Set this in /etc/rstudio/rserver.conf

rsession-ld-library-
path=/usr/lib64/R/lib:/home/oracle/app/oracle/product/12.1.0/client_1/lib

Then restart Rserver

sudo rstudio-server stop
sudo rstudio-server start

This helped me.

Dominique
  • 16,450
  • 15
  • 56
  • 112
Elango
  • 1