16

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?

bathyscapher
  • 1,615
  • 1
  • 13
  • 18
obrl_soil
  • 1,104
  • 12
  • 24
  • 1
    A side comment (which won't help the compilation problem): don't forget to install the VC Redistributable matching your Instant Client version. There are links on the Instant Client download pages. – Christopher Jones Sep 10 '18 at 04:07
  • Yes good to mention that @ChristopherJones, although I note that they don't nominate a redistributable for v 18 - not sure if that's an oversight or its only required for earlier versions. – obrl_soil Sep 10 '18 at 08:07
  • Each Instant Client version requires a specific redistributable version. – Christopher Jones Sep 10 '18 at 23:52

3 Answers3

19

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.

Eric Moffett
  • 206
  • 2
  • 3
16

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.

mirkhosro
  • 411
  • 5
  • 6
  • I sent an email to the maintainer on file at CRAN. Amazing job on finding this @mirkhosro – geneorama Dec 06 '18 at 23:22
  • 2
    The maintainer responded very quickly and said that it's fixed in the code, but they're trying to upload an update to CRAN (with a new driver). – geneorama Dec 06 '18 at 23:48
  • Thanks a lot @geneorama for contacting them. I'm glad to hear that they responded and it's gonna take effect :) – mirkhosro Dec 07 '18 at 19:36
  • The ROracle package still doesn't have this fix in fall 2021. However the recipe works swimmingly, thank you. – matt wilkie Oct 26 '21 at 23:35
  • It still doesn't seem to be fixed. After attempting the steps described about, i.e. modifying the configure.win, I get ``` : * installing *source* package 'ROracle' ... file 'configure.win' has the wrong MD5 checksum ** using staged installation Warning in system("sh ./configure.win") : 'sh' not found ERROR: configuration failed for package 'ROracle'``` – RTS Mar 15 '22 at 18:08
  • 1
    @RTS what version of R are you using? Is it newer that 3.2? – mirkhosro Mar 17 '22 at 02:04
  • August 2022: this hack is still necessary to install on R 4.2.1 ... – bathyscapher Aug 25 '22 at 09:37
0

I use 4.02. I found that the newest ROracle package on Oracle's website works with InstantClient and the Sys.setenv setup described above.

Thanks for the follow up mirkohosro.

RTS
  • 882
  • 1
  • 8
  • 13