Package: libbost-python1.34.0
Version: 1.34.0-1
Severity: High
I am using a Sidux system (derived from Debian sid). Kernel is
2.6.21.1-slh-up-7. Libc6 is version 2.5-7
I have code which includes:
#include <boost/python.hpp>
but compilation stops with this error:
... no error messages before...
/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
... stops after...
When I include the boost python header, a cascade of include ends up
including the header that causes the error.
This error shows only when I force my code (through a compilation
script) to work with python2.5 instead of the default python 2.4
The origin seems to be line 15 in /usr/include/boost/python/ssize_t.hpp:
typedef Py_ssize_t ssize_t;
which refreneces to line 110 in /usr/include/sys/types.h
typedef __ssize_t ssize_t
The problem seems not to be in my code, but in
usr/include/boost/python/ssize_t.hpp, which belongs to the package
"libboost_python1.34.0", and in types.h which belong to the package
"libc6-dev".
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
the ifndef around the declaration in /usr/include/sys/types.h seems not
to be able to prevent the problem
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
Valerio