尝试编译R包RSAP

时间:2017-06-08 12:32:38

标签: r package sap

我尝试使用命令

编译R包RSAP
R CMD INSTALL RSAP

必要的SAP库SAP NW RFCSDK位于C:\nwrfcsdk

  • 我在Windows 10 64上构建
  • R版本3.4 32位(我累了64位)
  • 使用mingw32的R工具

它不会编译,但会以下列错误终止:

c:/Rtools/mingw_32/bin/gcc -shared -s -static-libgcc -o RSAP.dll tmp.def RSAP.o -L. -LC:/nwrfcsdk/lib -lsapnwrfc -llibsapucum -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-34~1.0/bin/i386 -lR
RSAP.o:RSAP.c:(.text+0x4b): undefined reference to `RfcPing@8'
RSAP.o:RSAP.c:(.text+0x23a): undefined reference to `RfcUTF8ToSAPUC@24'
RSAP.o:RSAP.c:(.text+0x2d5): undefined reference to `RfcUTF8ToSAPUC@24'
RSAP.o:RSAP.c:(.text+0x369): undefined reference to `RfcUTF8ToSAPUC@24'
RSAP.o:RSAP.c:(.text+0x3ef): undefined reference to `RfcSAPUCToUTF8@24'
RSAP.o:RSAP.c:(.text+0x4b8): undefined reference to `RfcSAPUCToUTF8@24'
RSAP.o:RSAP.c:(.text+0x645): undefined reference to `RfcUTF8ToSAPUC@24'
RSAP.o:RSAP.c:(.text+0x6e3): undefined reference to `RfcUTF8ToSAPUC@24'
RSAP.o:RSAP.c:(.text+0x719): undefined reference to `RfcOpenConnection@12'
RSAP.o:RSAP.c:(.text+0x923): undefined reference to `RfcCloseConnection@8'
...

依此类推,直至停止

collect2.exe: error: ld returned 1 exit status
keine DLL erzeugt
ERROR: compilation failed for package 'RSAP'
* removing 'C:/Users/jmueller/R/win-library/3.4/RSAP'
* restoring previous 'C:/Users/jmueller/R/win-library/3.4/RSAP'

我做错了什么?任何帮助都非常感谢!

1 个答案:

答案 0 :(得分:0)

当您尝试使用64位版本的SAP NW RFC SDK在R的32位环境中构建RSAP时会发生这种情况。我遇到了同样的问题,在RGui的64位环境中执行以下命令后(位于SAP NW RFC SDK的64位版本C:\nwrfcsdk),未定义的引用已经消失。

<强>命令:

install.packages('RSAP', repos=c('http://piersharding.com/R'), type="source", configure.args=c('--with-nwrfcsdk-include=C:/nwrfcsdk/include --with-nwrfcsdk-lib=C:/nwrfcsdk/lib'))

如下所述: https://github.com/piersharding/RSAP/blob/master/INSTALL