jules
jules

Reputation: 1917

Trying to compile R Package RSAP

I'm trying to compile the R Package RSAP using the command

R CMD INSTALL RSAP

The necessary SAP library SAP NW RFCSDK is located in C:\nwrfcsdk.

It does not compile but terminates with the following errors:

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'
...

and so on until it stops with

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'

What am I doing wrong? Any help is highly appreciated!

Upvotes: 0

Views: 261

Answers (1)

turbolocust
turbolocust

Reputation: 314

This is what happens when you try to build RSAP in the 32-bit environment of R using the 64-bit version of the SAP NW RFC SDK. I had the same problem and after executing the following command in the 64-bit environment of RGui (with the 64-bit version of SAP NW RFC SDK located in C:\nwrfcsdk) the undefined references were gone.

Command:

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'))

as described in: https://github.com/piersharding/RSAP/blob/master/INSTALL

Upvotes: 0

Related Questions