You are not logged in.

#1 2007-03-30 13:54:24

valmar
Member
Registered: 2007-03-14
Posts: 55

ssize_t error with boost python after update

Good day everyone.

A problem emerged after my update yesterday.
I have some code which includes:

#include <boost/python.hpp>

but compilation stops with this error:

/usr/include/bits/fcntl.h:227: error: reference to 'ssize_t' is ambiguous
/usr/include/sys/types.h:110: error: candidates are: typedef __ssize_t ssize_t
/usr/include/boost/python/ssize_t.hpp:15: error: typedef Py_ssize_t boost::python::ssize_t
/usr/include/bits/fcntl.h:227: error: reference to 'ssize_t' is ambiguous
/usr/include/sys/types.h:110: error: candidates are: typedef __ssize_t ssize_t
/usr/include/boost/python/ssize_t.hpp:15: error: typedef Py_ssize_t boost::python::ssize_t
/usr/include/bits/fcntl.h:227: error: 'ssize_t' does not name a type


I am using arch64 (I hope it is ok to post here and not on the arch64 forum) with everything up to date as of today, March 30.
I have tried recompiling boost but that did not fix the problem.

The origin seems to be this line in /usr/include/boost/python/ssize_t.hpp:

typedef Py_ssize_t ssize_t;

which refreneces to this line in /usr/include/sys/types.h

typedef __ssize_t ssize_t

but as the error says, ssize_t seems not to be a type.

IYO should I file a bug?
Thank you for any  help you can provide

     Valerio

Abyone else experienced the same problem?

Offline

#2 2007-03-30 15:29:57

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: ssize_t error with boost python after update

Yeah this is a 64 bit issue.  Andy added a Mandriva based patch to fix this in our cvs:
http://cvs.archlinux.org/cgi-bin/viewcv … root=Extra

Offline

#3 2007-03-30 22:49:22

valmar
Member
Registered: 2007-03-14
Posts: 55

Re: ssize_t error with boost python after update

Thank you phrakture for you help.

I have already recompiled boost with ABS, which applies the patch.

I think that the patch is designed to make *boost* compile fine. Boost compiles fine on my machine now.
Instead I have problems with programs that *include* boost headers.  I cannot compile those!

As I said when I include the boost python header, a cascade of include ends up including the header that causes the error.

As you can notice from the error, the problem seems not to be in our code, but in usr/include/boost/python/ssize_t.hpp, which belongs to the package "boost", and in types.h which belong to the package "glib". While I don't fully understand the problem, it seems to me that the include file in boost treats ssize_t as a type while according to glib it is not. When the headers are included, the error happens.


           Valerio

Offline

#4 2007-03-31 13:37:38

valmar
Member
Registered: 2007-03-14
Posts: 55

Re: ssize_t error with boost python after update

I think I have insulated the origin of the problem and a potential solution.

The problem lies in the fact that ssize_t is declared twice, one in

/usr/include/sys/types.h: typedef __ssize_t ssize_t

and one in

/usr/include/boost/python/ssize_t.hpp: typedef Py_ssize_t boost::python::ssize_t

If I just comment out the line in /usr/include/boost/python/ssize_t.hpp:

#if PY_VERSION_HEX >= 0x02050000

- typedef Py_ssize_t ssize_t;
+ //typedef Py_ssize_t ssize_t;
ssize_t const ssize_t_max = PY_SSIZE_T_MAX;
ssize_t const ssize_t_min = PY_SSIZE_T_MIN;

#else

That leaves only one declaration and resolves the ambiguity. My code now compiles

I filed a bug report with all these notes.

Thank you for your help!

       Valerio

Offline

Board footer

Powered by FluxBB