ROracle软件包安装失败

时间:2018-09-07 04:33:46

标签: r windows-7-x64 roracle rtools

我知道有关此问题的其他问题,但是它们与我的系统设置或我遇到的安装错误没有太多共同之处,所以:

我正在使用Windows 7(64位)

我已经安装了64位Oracle Instant Client 18.3.0.0.0及其sdk和odbc扩展,可以从http://www.oracle.com/technetwork/topics/winx64soft-089540.html

获得。

我已将安装位置“ C:\ Oracle \ instantclient_18_3”放在PATH中。

我已经安装了R 3.5.1和Rtools 3.5;两者都在PATH上。

在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")

得出以下结果

* 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

Rtools找不到的ociver.h文件肯定存在于OCI_INC文件夹中,所以我不知道为什么会这样。有人对尝试什么有任何想法吗?

2 个答案:

答案 0 :(得分:6)

我遇到了完全相同的问题:

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.

一旦我更接近错误,我就意识到发生了什么。在我看来,Rtools的参数是将-I设置为R的包含文件夹,而不是OCI包含文件夹,然后猜测R的包含文件夹中没有什么?是的,ociver.h。我相信R会尝试将OCI包含文件夹的内容复制到R包含文件夹,因为此行距错误几行:

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

并且失败,也许以管理员身份运行会有所帮助?还是编辑文件夹权限?

无论如何,我手动将oracle include文件夹的内容复制到R include文件夹,这似乎为我解决了这个问题。

答案 1 :(得分:4)

感谢Eric的回答,它肯定有效!但是似乎问题出在包本身,而不是R试图将包含文件复制到R的包含文件夹中。因此,另一种解决方法是

  • 解压缩源存档,因此您的文件夹中有一个ROracle文件夹 当前目录
  • 编辑文件ROracle/configure.win并将以下行添加到文件末尾

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

  • 保存并关闭文件。现在,在当前目录中,在更新的软件包文件夹中运行install命令

    R CMD INSTALL ROracle

这应该可以解决问题。我不确定开发人员是否忘记在configure.win中包括该行,或者这仅发生在R的较新版本中,因为自2016年以来该包未进行过更新,他们在文档中提到ROracle支持R版本最高为3.2。