在Mac中安装ROracle

9
我正在使用Mac OS Sierra操作系统。
我尝试过执行以下操作 - 在OS X Mavericks上安装RODBC/ROracle包,但这并没有帮助我。
这是我所做的:
  • http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html下载了Basic、Sql plus和odbc。
  • 在我的主文件夹中解压缩到instantclient_12_1。
  • ln -s libclntsh.dylib.12.1 libclntsh.dylib
  • export DYLD_LIBRARY_PATH=/Users/dhananjaygoel/instantclient_12_1:$DYLD_LIBRARY_PATH
  • R CMD INSTALL --configure-args='--with-oci-lib=/Users/dhananjaygoel/instantclient_12_1' ROracle_1.3-1.tar.gz
它给出了以下错误:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library’
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: creating ./config.status
config.status: creating src/Makevars
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Users/dhananjaygoel/instantclient_12_1/sdk/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -I/opt/local/include -c rodbi.c -o rodbi.o
rodbi.c:2432:53: warning: format specifies type 'long long' but the argument has
      type 'sb8' (aka 'long') [-Wformat]
        sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                                                    ^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
rodbi.c:2469:53: warning: format specifies type 'long long' but the argument has
      type 'sb8' (aka 'long') [-Wformat]
        sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                                                    ^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
rodbi.c:2816:55: warning: format specifies type 'long long' but the argument has
      type 'sb8' (aka 'long') [-Wformat]
          sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                                                      ^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
rodbi.c:2861:55: warning: format specifies type 'long long' but the argument has
      type 'sb8' (aka 'long') [-Wformat]
          sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
                                                      ^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
4 warnings generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Users/dhananjaygoel/instantclient_12_1/sdk/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -I/opt/local/include -c rooci.c -o rooci.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o ROracle.so rodbi.o rooci.o -L/Users/dhananjaygoel/instantclient_12_1 -lclntsh -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs/ROracle.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs/ROracle.so, 6): Library not loaded: @rpath/libclntsh.dylib.12.1
  Referenced from: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs/ROracle.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle’

有人请帮忙。


你找到解决方案了吗? - sand
2个回答

3
以下方法已经在我使用的几台运行El Capitan的机器上起作用,因此也许可以在High Sierra上使用。与其他一些说明不同,这并不需要您禁用SIP。
  1. Install the Oracle Instant Client Basic, SDK, and SQL*Plus packages. I'm pretty sure I'm not using the ODBC package, though it shouldn't get in the way if you do have it.

  2. Create or edit ~/.R/Makevars. Add the following:

    CC=/usr/bin/clang -rpath /Users/dhananjaygoel/instantclient_12_1
    LDFLAGS=-L/Users/dhananjaygoel/instantclient_12_1
    

    Both the -rpath setting in CC and the -L linked directory in LDFLAGS should be the location of the Instant Client's .dylib files. If you've moved them to another location (I personally prefer to make a /lib subdirectory and put them there), that's where you should point.

  3. Run the install command:

    R CMD INSTALL --configure-args='--with-oci-lib=/Users/dhananjaygoel/instantclient_12_1' ROracle_1.3-1.tar.gz

    with --with-oci-lib= pointing to the root of the Instant Client (unlike the references in Makevars, this does not, as far as I know, rely on the location of the .dylib files).


1
仍适用于R3.6.2和MacOS Catalina。您的Mac将要求允许使用每个.dylib文件,因此需要一些时间,但最终您将能够使用ROracle。 - Carlos Celada

-1

我在Google搜索时找到了this
只需使用Ctrl+f(或Mac上的替代方法,我正在使用Linux)查找“image not found”,它会带您到问题所在。
该页面最终将引导您到here
这与您的错误非常相似,但是我没有使用Mac的经验,希望能有所帮助 :)


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接