2

I've downloaded ROracle 1.3-1.tar.gz and Oracle instant client 12.2 basic and devel rpms from Oracle.

As described in this post, I executed these commands:

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

I tried installing ROracle with

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

The output then says

* 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’

I tried exporting these enviromental variables and then running the command without arguments, but I get the same error.

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

I've also written the LD_LIBRARY_PATH to the conf file as described here via

echo "/usr/lib/oracle/12.2/client64/lib" | sudo tee /etc/ld.so.conf.d/oracle.conf

Still, I get the following error when trying to load ROracle from Rstudio:

> 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

I set a synlink from libclntsh.so.12.1 to libclntsh.so.11.1 at /usr/lib/oracle/12.2/client64/lib/ but it looks to me like RStudio is looking for my R at the wrong place - namely /usr/local/... instead of usr/.... How can I remedy this?

I also tried setting

export RSTUDIO_WHICH_R=/usr/bin/R

but it didn't help either.

s-heins
  • 679
  • 1
  • 8
  • 20

4 Answers4

0

Based on the ROracle INSTALL documentation, you should be using

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH

Note the missing $LD_LIBRARY_PATH.

After installation, you might want to see below for loading the package:

  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
chinsoon12
  • 25,005
  • 4
  • 25
  • 35
  • unfortunately, I'm still getting the same error message as I did with the previous command. – s-heins Nov 20 '17 at 14:10
  • you might not have admin rights. you might want to load it explicitly in R using `dyn.load('/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1')` i.e. the path to your shared obj. then run `install.packages('ROracle')` – chinsoon12 Nov 21 '17 at 00:45
  • thanks for your help. I do have admin rights, but the problem seems to be somewhere else. When I do as you say, R says "configure: error: OCI libraries not found" – s-heins Nov 21 '17 at 08:20
  • can you also share more detalis of the configure error? can u `ls` the libclntsh files in both /usr/lib/oracle/12.2/client64/lib and /usr/lib/oracle/12.2/client64/lib? – chinsoon12 Nov 22 '17 at 01:52
  • thank you again for your help. I added the lib information in to the question above. Unfortunately, the error doesn't say much more: `* installing *source* package ‘ROracle’ ... ** package ‘ROracle’ successfully unpacked and MD5 sums checked configure: error: OCI libraries not found ERROR: configuration failed for package ‘ROracle’ * removing ‘/home/[user]/R/x86_64-pc-linux-gnu-library/3.4/ROracle’` – s-heins Dec 14 '17 at 14:59
  • just to double check that you are also using the 64-bit R? – chinsoon12 Dec 15 '17 at 02:13
0

installing ROracle is a real pain in the as. What I have found to work quite well is not prepend sudo to every installation command but rather to switch to superuser with sudo su and then perform the whole installation as super user. I'm no Linux expert so I can't tell you really why this is a more stable way. But it works for us.

WE also added a bash file oracle.sh to /etc/profile.d/

oracle.sh

LD_LIBRARY_PATH="/usr/lib/oracle/12.1/client64/lib:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
Bertil Baron
  • 4,923
  • 1
  • 15
  • 24
0
sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-
instantclient.conf" sudo ldconfig

described in

https://github.com/oracle/node-oracledb/issues/453

worked for me.

I used

dyn.load('/usr/lib/oracle/12.1/client64/lib/libclntsh.so.12.1')

in R to check. Before executing commands described above it returned error.

I wonder what's the difference (if any) between oracle.conf mentioned before (check here) and oracle-instantclient.conf

AdamB
  • 788
  • 5
  • 11
0

This solved my issue:

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
gravity
  • 2,175
  • 2
  • 26
  • 34
John
  • 1
  • Welcome to StackOverflow! Thank you for your contribution. To increase the value of your solution, please provide some context, why and how your solution works. Please take some time to look at the [help center](https://stackoverflow.com/help), especially at the [formatting](https://stackoverflow.com/help/formatting) section. – Qw3ry Jun 27 '19 at 16:06