Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ROracle package installation failure

I'm aware of the other questions about this issue, but they don't have much in common with my system setup or the installation error I'm getting, so:

I am using Windows 7, 64 bit

I have installed the 64 bit Oracle Instant Client 18.3.0.0.0 along with its sdk and odbc extensions, available from http://www.oracle.com/technetwork/topics/winx64soft-089540.html

I've put the install location `C:\Oracle\instantclient_18_3' on the PATH.

I have installed R 3.5.1 and Rtools 3.5; both are on the PATH.

In R,

Sys.setenv(
  'ORACLE_HOME' = 'C:/Oracle/instantclient_18_3',
  'OCI_INC'     = 'C:/Oracle/instantclient_18_3/sdk/include',
  'OCI_LIB64'   = 'C:/Oracle/instantclient_18_3'
  )
install.packages("ROracle", type="source")

results in the following

* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
Oracle Client Shared Library 64-bit - 18.3.0.0.0 Operating in Instant Client mode.
found Oracle Client C:/Oracle/instantclient_18_3
found Oracle Client include C:/Oracle/instantclient_18_3/sdk/include
copying from C:/Oracle/instantclient_18_3/sdk/include
** libs
c:/Rtools/mingw_64/bin/gcc  -I"C:/Program Files/R/R-3.5.1/include" -DNDEBUG -I./oci         -O2 -Wall  -std=gnu99 -mtune=generic -c rodbi.c -o rodbi.o
In file included from rooci.h:75:0,
                 from rodbi.c:181:
./oci/oci.h:716:20: fatal error: ociver.h: No such file or directory
 #include <ociver.h>
                    ^
compilation terminated.
make: *** [C:/Program Files/R/R-3.5.1/etc/x64/Makeconf:208: rodbi.o] Error 1
ERROR: compilation failed for package 'ROracle'
* removing 'C:/Users/obrienle/Documents/R/win-library/3.5/ROracle'
In R CMD INSTALL
Warning in install.packages :
  installation of package ‘ROracle’ had non-zero exit status

The file ociver.h that Rtools can't locate is definitely present in the OCI_INC folder, so I don't know why this is happening. Does anyone have any ideas about what to try?

like image 224
obrl_soil Avatar asked Sep 07 '18 04:09

obrl_soil


2 Answers

Thanks to Eric for his answer, it definitely works! But it seems the problem is with the package itself, and not with R trying to copy the include files into R's include folder. So an alternative fix is to

  • Decompress the source archive so there's a ROracle folder in your current directory
  • Edit the file ROracle/configure.win and add the following line to the end of the file

    cp ${ROCI_INC}/ociver.h ./src/oci

  • Save and close the file. Now in your current directory run the install command on your updated package folder

    R CMD INSTALL ROracle

This should fix the problem. I'm not sure if the developers forgot to include that line in configure.win or that this is something that happens to newer versions of R only, since the package hasn't been updated since 2016 and in the docs they mention that ROracle supports R versions up to 3.2.

like image 189
mirkhosro Avatar answered Nov 14 '22 20:11

mirkhosro


I had the exact same problem:

c:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG -I./oci         -O2 -Wall  -std=gnu99 -mtune=generic -c rodbi.c -o rodbi.o
In file included from rooci.h:75:0,
                 from rodbi.c:181:
./oci/oci.h:716:20: fatal error: ociver.h: No such file or directory
 #include <ociver.h>
                    ^
compilation terminated.

Once I looked a lot closer to the error I realized what was happening. It looked to me that the arguments for Rtools was setting -I to R's include folder, not the OCI include folder, and guess what isn't in R's include folder? That's right, ociver.h. I believe R tries to copy the contents of the OCI include folder to the R include folder because of this line a few lines up from the error:

copying from C:\Oracle\instantclient_18_3\sdk\include\

and fails maybe running as administrator will help? Or perhaps editing folder permissions?

Anyway, I manually copied the contents of the oracle include folder to the R include folder and that seemed to fix the problem for me.

like image 18
Eric Moffett Avatar answered Nov 14 '22 20:11

Eric Moffett