ROracle包安装失败

问题描述 投票:0回答:4

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

我使用的是 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
文件夹中,所以我不知道为什么会发生这种情况。有人知道要尝试什么吗?

r windows-7-x64 roracle rtools
4个回答
21
投票

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

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 文件夹,这似乎解决了我的问题。


17
投票

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

  • 解压源存档,这样你的文件夹中就会有一个
    ROracle
    文件夹 当前目录
  • 编辑文件

    ROracle/configure.win
    并将以下行添加到文件末尾

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

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

    R CMD INSTALL ROracle

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


0
投票

我用的是4.02。我发现 Oracle 网站上最新的 ROracle 软件包 可与上述 InstantClient 和 Sys.setenv 设置配合使用。

感谢 mirkohosro 的跟进。


0
投票

我发布了一个 ROracle 的分支存储库,它修复了 Windows 中的两个构建错误:

  1. 按照 Eric Moffitt 的建议,复制丢失的文件 ociver.h。
  2. 引用 Oracle 客户端目录的文件路径,这可以修复路径包含空格时的错误。

要使用它代替 CRAN 存储库,只需运行

devtools::install_github('andrew-schulman/ROracle')
© www.soinside.com 2019 - 2024. All rights reserved.