Discussion:
Pyrex bindings with python2.7
Tejas Guruswamy
2010-10-16 19:59:44 UTC
Permalink
All,

librapi2 / librra python bindings fail to build on openSUSE Factory, and
the only recent relevant change I can find is python2.7 .
gcc is 4.5, pyrex is 0.9.8.5.

So does anyone have SynCE successfully building against python2.7?

It's a rather unhelpful error it's spitting out:

make[3]: Entering directory `/usr/src/packages/BUILD/librapi2-0.15/python'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I.
-I.. -I/usr/include/python2.7 -I../src -pthread -Wsign-compare
-Wno-long-long -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -MT
pyrapi2_la-pyrapi2.lo -MD -MP -MF .deps/pyrapi2_la-pyrapi2.Tpo -c -o
pyrapi2_la-pyrapi2.lo `test -f 'pyrapi2.c' || echo './'`pyrapi2.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.7
-I../src -pthread -Wsign-compare -Wno-long-long -fmessage-length=0 -O2
-Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -MT pyrapi2_la-pyrapi2.lo -MD -MP -MF
.deps/pyrapi2_la-pyrapi2.Tpo -c pyrapi2.c -fPIC -DPIC -o
.libs/pyrapi2_la-pyrapi2.o
In file included from /usr/include/synce.h:24:0,
from pyrapi2.c:32:
/usr/include/synce_types.h:41:16: error: expected identifier or '('
before string constant
In file included from pyrapi2.c:32:0:
/usr/include/synce.h:51:36: error: expected declaration specifiers or
'...' before string constant
/usr/include/synce.h:52:18: error: expected declaration specifiers or
'...' before string constant

which points to just a simple "typedef double DATE;" line.

Or am I missing something obvious?

Regards,
Tejas
Mark Ellis
2010-10-17 19:52:20 UTC
Permalink
Post by Tejas Guruswamy
All,
librapi2 / librra python bindings fail to build on openSUSE Factory, and
the only recent relevant change I can find is python2.7 .
gcc is 4.5, pyrex is 0.9.8.5.
So does anyone have SynCE successfully building against python2.7?
make[3]: Entering directory `/usr/src/packages/BUILD/librapi2-0.15/python'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I.
-I.. -I/usr/include/python2.7 -I../src -pthread -Wsign-compare
-Wno-long-long -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -MT
pyrapi2_la-pyrapi2.lo -MD -MP -MF .deps/pyrapi2_la-pyrapi2.Tpo -c -o
pyrapi2_la-pyrapi2.lo `test -f 'pyrapi2.c' || echo './'`pyrapi2.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.7
-I../src -pthread -Wsign-compare -Wno-long-long -fmessage-length=0 -O2
-Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -MT pyrapi2_la-pyrapi2.lo -MD -MP -MF
.deps/pyrapi2_la-pyrapi2.Tpo -c pyrapi2.c -fPIC -DPIC -o
.libs/pyrapi2_la-pyrapi2.o
In file included from /usr/include/synce.h:24:0,
/usr/include/synce_types.h:41:16: error: expected identifier or '('
before string constant
/usr/include/synce.h:51:36: error: expected declaration specifiers or
'...' before string constant
/usr/include/synce.h:52:18: error: expected declaration specifiers or
'...' before string constant
which points to just a simple "typedef double DATE;" line.
I suspect it's gcc 4.5 rather than python that is causing the problem,
but it's just a guess at this point. Apparently gcc 4.5 is stricter, but
I still can't see what the problem with that line would be. Can you try
and build librapi2 with python disabled, see if you get this error
anywhere else ?
Post by Tejas Guruswamy
Or am I missing something obvious?
Regards,
Tejas
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
SynCE-Devel mailing list
https://lists.sourceforge.net/lists/listinfo/synce-devel
Tejas Guruswamy
2010-10-17 23:03:46 UTC
Permalink
Post by Mark Ellis
Post by Tejas Guruswamy
librapi2 / librra python bindings fail to build on openSUSE Factory, and
the only recent relevant change I can find is python2.7 .
gcc is 4.5, pyrex is 0.9.8.5.
So does anyone have SynCE successfully building against python2.7?
make[3]: Entering directory `/usr/src/packages/BUILD/librapi2-0.15/python'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I.
-I.. -I/usr/include/python2.7 -I../src -pthread -Wsign-compare
-Wno-long-long -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -MT
pyrapi2_la-pyrapi2.lo -MD -MP -MF .deps/pyrapi2_la-pyrapi2.Tpo -c -o
pyrapi2_la-pyrapi2.lo `test -f 'pyrapi2.c' || echo './'`pyrapi2.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.7
-I../src -pthread -Wsign-compare -Wno-long-long -fmessage-length=0 -O2
-Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -MT pyrapi2_la-pyrapi2.lo -MD -MP -MF
.deps/pyrapi2_la-pyrapi2.Tpo -c pyrapi2.c -fPIC -DPIC -o
.libs/pyrapi2_la-pyrapi2.o
In file included from /usr/include/synce.h:24:0,
/usr/include/synce_types.h:41:16: error: expected identifier or '('
before string constant
/usr/include/synce.h:51:36: error: expected declaration specifiers or
'...' before string constant
/usr/include/synce.h:52:18: error: expected declaration specifiers or
'...' before string constant
which points to just a simple "typedef double DATE;" line.
I suspect it's gcc 4.5 rather than python that is causing the problem,
but it's just a guess at this point. Apparently gcc 4.5 is stricter, but
I still can't see what the problem with that line would be. Can you try
and build librapi2 with python disabled, see if you get this error
anywhere else ?
Builds fine with gcc 4.5.1 and --disable-python-bindings. Builds fine
with gcc 4.5.0 on openSUSE 11.3 -- and I don't see anything relevant in
the changelog for 4.5.0 to 4.5.1.

Fails even without the extra RPM compiler flags.

I see that Ubuntu seems to be still building with python2.6 ... have you
got a way to test with 2.7? Could it be a pyrex issue?

Regards,
Tejas
Tejas Guruswamy
2010-10-18 18:08:00 UTC
Permalink
Post by Tejas Guruswamy
Post by Mark Ellis
Post by Tejas Guruswamy
librapi2 / librra python bindings fail to build on openSUSE Factory, and
the only recent relevant change I can find is python2.7 .
gcc is 4.5, pyrex is 0.9.8.5.
So does anyone have SynCE successfully building against python2.7?
make[3]: Entering directory `/usr/src/packages/BUILD/librapi2-0.15/python'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I.
-I.. -I/usr/include/python2.7 -I../src -pthread -Wsign-compare
-Wno-long-long -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -MT
pyrapi2_la-pyrapi2.lo -MD -MP -MF .deps/pyrapi2_la-pyrapi2.Tpo -c -o
pyrapi2_la-pyrapi2.lo `test -f 'pyrapi2.c' || echo './'`pyrapi2.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.7
-I../src -pthread -Wsign-compare -Wno-long-long -fmessage-length=0 -O2
-Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -MT pyrapi2_la-pyrapi2.lo -MD -MP -MF
.deps/pyrapi2_la-pyrapi2.Tpo -c pyrapi2.c -fPIC -DPIC -o
.libs/pyrapi2_la-pyrapi2.o
In file included from /usr/include/synce.h:24:0,
/usr/include/synce_types.h:41:16: error: expected identifier or '('
before string constant
/usr/include/synce.h:51:36: error: expected declaration specifiers or
'...' before string constant
/usr/include/synce.h:52:18: error: expected declaration specifiers or
'...' before string constant
which points to just a simple "typedef double DATE;" line.
I suspect it's gcc 4.5 rather than python that is causing the problem,
but it's just a guess at this point. Apparently gcc 4.5 is stricter, but
I still can't see what the problem with that line would be. Can you try
and build librapi2 with python disabled, see if you get this error
anywhere else ?
Builds fine with gcc 4.5.1 and --disable-python-bindings. Builds fine
with gcc 4.5.0 on openSUSE 11.3 -- and I don't see anything relevant in
the changelog for 4.5.0 to 4.5.1.
Fails even without the extra RPM compiler flags.
I see that Ubuntu seems to be still building with python2.6 ... have you
got a way to test with 2.7? Could it be a pyrex issue?
Solved; looks like python2.7 declares "DATE" as something else and
gcc4.5.1 no longer lets this slide. Change that typedef (and all
references to that type) to some other name (in libsynce) and
python-bindings build OK.

Regards,
Tejas
David Eriksson
2010-10-19 09:06:46 UTC
Permalink
If I remember correctly, DATE is one of the types in synce_types.h,
which are meant to have the same name and declaration as in Microsoft
Windows. Changing it in libsynce will diverge from that and also means
changing librapi2 and many tools and applications that depend on that
library.

It would probably be better to hide the Python declaration of DATE
with some #define/#undef magic... :-)


Best regards,

David Eriksson
http://www.divideandconquer.se/
Post by Tejas Guruswamy
Post by Tejas Guruswamy
Post by Mark Ellis
Post by Tejas Guruswamy
librapi2 / librra python bindings fail to build on openSUSE Factory, and
the only recent relevant change I can find is python2.7 .
gcc is 4.5, pyrex is 0.9.8.5.
So does anyone have SynCE successfully building against python2.7?
make[3]: Entering directory `/usr/src/packages/BUILD/librapi2-0.15/python'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I..    -I/usr/include/python2.7   -I../src -pthread -Wsign-compare
-Wno-long-long -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -MT
pyrapi2_la-pyrapi2.lo -MD -MP -MF .deps/pyrapi2_la-pyrapi2.Tpo -c -o
pyrapi2_la-pyrapi2.lo `test -f 'pyrapi2.c' || echo './'`pyrapi2.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.7
-I../src -pthread -Wsign-compare -Wno-long-long -fmessage-length=0 -O2
-Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables
-fasynchronous-unwind-tables -g -MT pyrapi2_la-pyrapi2.lo -MD -MP -MF
.deps/pyrapi2_la-pyrapi2.Tpo -c pyrapi2.c  -fPIC -DPIC -o
.libs/pyrapi2_la-pyrapi2.o
In file included from /usr/include/synce.h:24:0,
/usr/include/synce_types.h:41:16: error: expected identifier or '('
before string constant
/usr/include/synce.h:51:36: error: expected declaration specifiers or
'...' before string constant
/usr/include/synce.h:52:18: error: expected declaration specifiers or
'...' before string constant
which points to just a simple "typedef double DATE;" line.
I suspect it's gcc 4.5 rather than python that is causing the problem,
but it's just a guess at this point. Apparently gcc 4.5 is stricter, but
I still can't see what the problem with that line would be. Can you try
and build librapi2 with python disabled, see if you get this error
anywhere else ?
Builds fine with gcc 4.5.1 and --disable-python-bindings. Builds fine
with gcc 4.5.0 on openSUSE 11.3 -- and I don't see anything relevant in
the changelog for 4.5.0 to 4.5.1.
Fails even without the extra RPM compiler flags.
I see that Ubuntu seems to be still building with python2.6 ... have you
got a way to test with 2.7? Could it be a pyrex issue?
Solved; looks like python2.7 declares "DATE" as something else and
gcc4.5.1 no longer lets this slide. Change that typedef (and all
references to that type) to some other name (in libsynce) and
python-bindings build OK.
Regards,
Tejas
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
SynCE-Devel mailing list
https://lists.sourceforge.net/lists/listinfo/synce-devel
Tejas Guruswamy
2010-10-19 12:02:31 UTC
Permalink
Post by David Eriksson
If I remember correctly, DATE is one of the types in synce_types.h,
which are meant to have the same name and declaration as in Microsoft
Windows. Changing it in libsynce will diverge from that and also means
changing librapi2 and many tools and applications that depend on that
library.
It would probably be better to hide the Python declaration of DATE
with some #define/#undef magic... :-)
Best regards,
David Eriksson
http://www.divideandconquer.se/
Luckily, the python declaration was just a #define, so it can be #undef'd.
This isn't an issue with python2.6 or before, even with gcc 4.5.1, btw.

Here's a patch for libsynce that allows building the python rapi2 and
rra bindings again.

Does it make sense?

Regards,
Tejas

Index: libsynce-0.15/lib/synce_types.h
===================================================================
--- libsynce-0.15.orig/lib/synce_types.h
+++ libsynce-0.15/lib/synce_types.h
@@ -38,6 +38,8 @@ typedef uint64_t ULARGE_INTEGER;


/* XXX: sizeof(double) must be 8 */
+//Python2.7 defines DATE as a macro in /usr/include/python2.7/pyconfig.h
+#undef DATE
typedef double DATE;

/*
Mark Ellis
2010-10-19 14:51:54 UTC
Permalink
Post by Tejas Guruswamy
Post by David Eriksson
If I remember correctly, DATE is one of the types in synce_types.h,
which are meant to have the same name and declaration as in Microsoft
Windows. Changing it in libsynce will diverge from that and also means
changing librapi2 and many tools and applications that depend on that
library.
It would probably be better to hide the Python declaration of DATE
with some #define/#undef magic... :-)
Best regards,
David Eriksson
http://www.divideandconquer.se/
Luckily, the python declaration was just a #define, so it can be #undef'd.
This isn't an issue with python2.6 or before, even with gcc 4.5.1, btw.
Here's a patch for libsynce that allows building the python rapi2 and
rra bindings again.
That's remarkably inconvenient of them. Can you see where DATE is
defined in python, and what it is defined to ? Redefining it is fine for
our code, but we might break something else in the bindings.
Post by Tejas Guruswamy
Does it make sense?
Regards,
Tejas
Index: libsynce-0.15/lib/synce_types.h
===================================================================
--- libsynce-0.15.orig/lib/synce_types.h
+++ libsynce-0.15/lib/synce_types.h
@@ -38,6 +38,8 @@ typedef uint64_t ULARGE_INTEGER;
/* XXX: sizeof(double) must be 8 */
+//Python2.7 defines DATE as a macro in /usr/include/python2.7/pyconfig.h
+#undef DATE
typedef double DATE;
/*
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
SynCE-Devel mailing list
https://lists.sourceforge.net/lists/listinfo/synce-devel
Tejas Guruswamy
2010-10-19 15:04:04 UTC
Permalink
Post by Mark Ellis
Post by Tejas Guruswamy
Post by David Eriksson
If I remember correctly, DATE is one of the types in synce_types.h,
which are meant to have the same name and declaration as in Microsoft
Windows. Changing it in libsynce will diverge from that and also means
changing librapi2 and many tools and applications that depend on that
library.
It would probably be better to hide the Python declaration of DATE
with some #define/#undef magic... :-)
Best regards,
David Eriksson
http://www.divideandconquer.se/
Luckily, the python declaration was just a #define, so it can be #undef'd.
This isn't an issue with python2.6 or before, even with gcc 4.5.1, btw.
Here's a patch for libsynce that allows building the python rapi2 and
rra bindings again.
That's remarkably inconvenient of them. Can you see where DATE is
defined in python, and what it is defined to ? Redefining it is fine for
our code, but we might break something else in the bindings.
Found it, here's the context:

/usr/include/python2.7/pyconfig.h: 1247:
#define COMPILER "[GCC]"
#define DATE "Aug 07 2010"
#define TIME "16:54:59"

Which is just the python package build info, inserted by configure. I'd
be surprised if anyone is using it to do anything important ...
Post by Mark Ellis
Post by Tejas Guruswamy
Index: libsynce-0.15/lib/synce_types.h
===================================================================
--- libsynce-0.15.orig/lib/synce_types.h
+++ libsynce-0.15/lib/synce_types.h
@@ -38,6 +38,8 @@ typedef uint64_t ULARGE_INTEGER;
/* XXX: sizeof(double) must be 8 */
+//Python2.7 defines DATE as a macro in /usr/include/python2.7/pyconfig.h
+#undef DATE
typedef double DATE;
Regards,
Tejas
Mark Ellis
2010-10-22 07:14:30 UTC
Permalink
Post by Tejas Guruswamy
Post by Mark Ellis
Post by Tejas Guruswamy
Post by David Eriksson
If I remember correctly, DATE is one of the types in synce_types.h,
which are meant to have the same name and declaration as in Microsoft
Windows. Changing it in libsynce will diverge from that and also means
changing librapi2 and many tools and applications that depend on that
library.
It would probably be better to hide the Python declaration of DATE
with some #define/#undef magic... :-)
Best regards,
David Eriksson
http://www.divideandconquer.se/
Luckily, the python declaration was just a #define, so it can be #undef'd.
This isn't an issue with python2.6 or before, even with gcc 4.5.1, btw.
Here's a patch for libsynce that allows building the python rapi2 and
rra bindings again.
I'd feel more comfortable doing something to undef it in the wrapper
source rather than the general headers, but that should be easy enough,
I think.
Post by Tejas Guruswamy
Post by Mark Ellis
That's remarkably inconvenient of them. Can you see where DATE is
defined in python, and what it is defined to ? Redefining it is fine for
our code, but we might break something else in the bindings.
#define COMPILER "[GCC]"
#define DATE "Aug 07 2010"
#define TIME "16:54:59"
Which is just the python package build info, inserted by configure. I'd
be surprised if anyone is using it to do anything important ...
The interesting part is that this appears nowhere in the corresponding
file on ubuntu. It's a very common name to use in a define that might be
included elsewhere. Any other distros have this appearing ?
Post by Tejas Guruswamy
Post by Mark Ellis
Post by Tejas Guruswamy
Index: libsynce-0.15/lib/synce_types.h
===================================================================
--- libsynce-0.15.orig/lib/synce_types.h
+++ libsynce-0.15/lib/synce_types.h
@@ -38,6 +38,8 @@ typedef uint64_t ULARGE_INTEGER;
/* XXX: sizeof(double) must be 8 */
+//Python2.7 defines DATE as a macro in /usr/include/python2.7/pyconfig.h
+#undef DATE
typedef double DATE;
Regards,
Tejas
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
SynCE-Devel mailing list
https://lists.sourceforge.net/lists/listinfo/synce-devel
David Eriksson
2010-10-22 07:51:49 UTC
Permalink
Post by Mark Ellis
Post by Tejas Guruswamy
Luckily, the python declaration was just a #define, so it can be #undef'd.
This isn't an issue with python2.6 or before, even with gcc 4.5.1, btw.
Here's a patch for libsynce that allows building the python rapi2 and
rra bindings again.
I'd feel more comfortable doing something to undef it in the wrapper
source rather than the general headers, but that should be easy enough,
I think.
+1

Cheers,

David
Tejas Guruswamy
2010-10-24 09:26:12 UTC
Permalink
Post by Mark Ellis
I'd feel more comfortable doing something to undef it in the wrapper
source rather than the general headers, but that should be easy enough,
I think.
Post by Tejas Guruswamy
#define COMPILER "[GCC]"
#define DATE "Aug 07 2010"
#define TIME "16:54:59"
Which is just the python package build info, inserted by configure. I'd
be surprised if anyone is using it to do anything important ...
The interesting part is that this appears nowhere in the corresponding
file on ubuntu. It's a very common name to use in a define that might be
included elsewhere. Any other distros have this appearing ?
I talked to the openSUSE python maintainer and it turns out it's just a
suse-specific hack to avoid having the buildtime in the python package.

So you guys are all safe from this silly issue, thanks for the help in
solving anyway.

Regards,
Tejas
Mark Ellis
2010-10-24 15:27:34 UTC
Permalink
Post by Tejas Guruswamy
Post by Mark Ellis
I'd feel more comfortable doing something to undef it in the wrapper
source rather than the general headers, but that should be easy enough,
I think.
Post by Tejas Guruswamy
#define COMPILER "[GCC]"
#define DATE "Aug 07 2010"
#define TIME "16:54:59"
Which is just the python package build info, inserted by configure. I'd
be surprised if anyone is using it to do anything important ...
The interesting part is that this appears nowhere in the corresponding
file on ubuntu. It's a very common name to use in a define that might be
included elsewhere. Any other distros have this appearing ?
I talked to the openSUSE python maintainer and it turns out it's just a
suse-specific hack to avoid having the buildtime in the python package.
Ah, that's slightly less bewildering then.

I would still recommend undef'ing DATE in the python binding file
instead of the synce header, just before the synce header gets included,
but how you'd do that in an opensuse package I don't know.
Post by Tejas Guruswamy
So you guys are all safe from this silly issue, thanks for the help in
solving anyway.
Regards,
Tejas
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
SynCE-Devel mailing list
https://lists.sourceforge.net/lists/listinfo/synce-devel
Continue reading on narkive:
Search results for 'Pyrex bindings with python2.7' (Questions and Answers)
16
replies
My Son wants a pet lizard, where do I start?
started 2007-05-16 04:40:22 UTC
reptiles
Loading...