piersharding / python-sapnwrfc

SAP RFC Connector using the SAP NW RFC SDK for Python
http://www.piersharding.com/blog/
GNU Lesser General Public License v2.1
26 stars 9 forks source link

preprocessing token #9

Open itnazeer opened 6 years ago

itnazeer commented 6 years ago

Hi, I am getting below error while doing build. Please help on this.

python 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.4 creating build/temp.linux-x86_64-3.4 creating build/temp.linux-x86_64-3.4/src gcc -pthread -Wno-unused-result -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -D_LARGEFILE_SOURCE -DSAPwithUNICODE -DSAPonUNIX -D__NO_MATH_INLINES -DSAPwithTHREADS -I/usr/sap/nwrfcsdk/include -I/usr/include/python3.4m -c src/nwsaprfcutil.c -o build/temp.linux-x86_64-3.4/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:9:0, from src/nwsaprfcutil.c:35: /usr/sap/nwrfcsdk/include/sapuc.h:907: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/sapuc.h:887: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/sapuc.h:881:27: 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/sapuc.h:907: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/sapuc.h:887: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/sapuc.h:881:27: 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

piersharding commented 6 years ago

Hi - this looks like a preprocessor error, which I have not seen before. Is this a very new version of the nwrfcsdk that you are using?

itnazeer commented 6 years ago

Yes, this is the new version


From: Piers Harding notifications@github.com Sent: Sunday, September 16, 2018 2:17:10 AM To: piersharding/python-sapnwrfc Cc: itnazeer; Author Subject: Re: [piersharding/python-sapnwrfc] preprocessing token (#9)

Hi - this looks like a preprocessor error, which I have not seen before. Is this a very new version of the nwrfcsdk that you are using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/piersharding/python-sapnwrfc/issues/9#issuecomment-421632144, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJsbn6MTNgPgBZXc6gIvhQiH7sJjzozYks5ubWdOgaJpZM4Wqfg-.

piersharding commented 6 years ago

OK - so I don't have access to an SAP system or the latest SAP NW RFC SDK, so I cannot see what is causing this. You could try obtaining an older (eg: 12 month old) version of the SDK and see if that will work. If we can work out at which version of the SDK things have changed, then we could do a diff between the two to figure out how the preprocessor step needs to be updated. The preprocessor is performed by the u16lit.pl script in the tools directory. This is a script that was provided by SAP many years ago, so maybe there is something there that should be updated.

itnazeer commented 6 years ago

Please share the old version sdk url such that I will work on it.

guettli commented 6 years ago

I am curious. Why do you use python-sapnwrfc and not https://sap.github.io/PyRFC/ ?

eyesonly commented 6 years ago

I am curious. Why do you use python-sapnwrfc and not https://sap.github.io/PyRFC/ ?

Agree also, pyrfc for future implementations. Use Piers' connector for Ruby though as I do not know of a pyrfc equivalent for that language.

decke commented 3 years ago

The problem is that you very likely use an old compiler which defaults to C99. String literals were improved a lot in C11 especially for unicode strings so you need to use gcc 4.6+ and need to tell it to use C11 by adding "-std=c11". gcc 5.1+ already defaults to C11.