Cannot build sapnwrfc for monitoring SAP

Hi,

I’m trying to build the sapnwrfc python module shipped with check_mk so I can monitor a SAP system. I’ve installed the nwrfc750P development kit from SAP in /usr/sap. However when I try to build the python module I get the following error:

python3 setup.py build
running build
running build_py
running build_ext
In my own BUILD_EXTENSIONS...

building 'nwsaprfcutil' extension
rm -rf build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -D_LARGEFILE_SOURCE -DSAPwithUNICODE -DSAPonUNIX -D__NO_MATH_INLINES -DSAPwithTHREADS -I/usr/sap/nwrfcsdk/include -I/usr/include/python3.6m -c src/nwsaprfcutil.c -o build/temp.linux-x86_64-3.6/src/nwsaprfcutil.o -E -mno-3dnow -fno-strict-aliasing -pipe -fexceptions -funsigned-char -Wall -Wno-uninitialized -Wno-long-long -Wcast-align -fPIC
In file included from /usr/sap/nwrfcsdk/include/sapnwrfc.h:7:0,
                 from src/nwsaprfcutil.c:35:
/usr/sap/nwrfcsdk/include/sapucrfc.h:1255:26: error: pasting "u" and ""RFC ERR %s: %s\n"" does not give a valid preprocessing token
   #define cU16_HELP(par) u##par
                          ^
/usr/sap/nwrfcsdk/include/sapucrfc.h:1235:24: note: in expansion of macro ‘cU16_HELP’
 #define cU16(par)      cU16_HELP(par) /* if par is a macro, it must be ...    */
                        ^
/usr/sap/nwrfcsdk/include/sapucrfc.h:1231:25: note: in expansion of macro ‘cU16’
 #define cU(par)         cU16(par)
                         ^
src/nwsaprfcutil.c:497:22: note: in expansion of macro ‘cU’
     fprintfU(stderr, cU("RFC ERR %s: %s\n"), errorInfo.key, errorInfo.message);
                      ^
/usr/sap/nwrfcsdk/include/sapucrfc.h:1255:26: error: pasting "u" and ""RfcDestroyFunction: %d - %s - %s\n"" does not give a valid preprocessing token
   #define cU16_HELP(par) u##par
                          ^
/usr/sap/nwrfcsdk/include/sapucrfc.h:1235:24: note: in expansion of macro ‘cU16_HELP’
 #define cU16(par)      cU16_HELP(par) /* if par is a macro, it must be ...    */
                        ^
/usr/sap/nwrfcsdk/include/sapucrfc.h:1231:25: note: in expansion of macro ‘cU16’
 #define cU(par)         cU16(par)
                         ^
src/nwsaprfcutil.c:737:22: note: in expansion of macro ‘cU’
     fprintfU(stderr, cU("RfcDestroyFunction: %d - %s - %s\n"),
                      ^
error: command 'gcc' failed with exit status 1

Has anyone been able to build this module? I also tried building using python2 but that gives the same result. This is on a RHEL7 system.

Hi Louis,

Maybe this workaround idea might help, as due to a missing registration at SAP portal the SDK is unavailable to me.

As in the docs (https://checkmk.de/cms_legacy_sap_r3.html) it is indicated that this compilation does not need to be done on the host to be monitored, you could prepare a compilation vm for this purpose. Though of course these produced files need to be suited for your target RHEL7, the compilation vm can have a quite old system, as the source code sapnwrfc-0.19.tgz originates in 2012.

Hi Dennis,

Thanks, I’ll give it a try. Though it might not be needed anymore as my company is now looking into other solutions for monitoring SAP systems. Then again, I’d really like to get it to work, so I’ll give it a go when I find time for this.

Hi Louis,
I got the unverified information that with a sap nw rfc sdk version prior to 750 it is possible to compile, then you could upgrade. It is important to use the original sapnwrfc-0.19.tar.gz then, cause there are some forks around.
Maybe you can verify this.

Hi Dennis,

Thanks for the suggestion. I’ll see if I can get my hands on a version prior to 750, as SAP doesn’t offer it for download anymore; only 750.