FS#6766 - programs which include boost headers file to compile
Attached to Project:
Arch Linux
Opened by Valerio Mariani (valmar) - Saturday, 31 March 2007, 02:34 GMT
Last edited by Aaron Griffin (phrakture) - Monday, 03 March 2008, 19:09 GMT
Opened by Valerio Mariani (valmar) - Saturday, 31 March 2007, 02:34 GMT
Last edited by Aaron Griffin (phrakture) - Monday, 03 March 2008, 19:09 GMT
|
Details
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... 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. The problem seems not to be in my 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. I am using arch64 with everything up to date as of today, March 30. I have already tried recompiling boost with ABS, which applies a patch related to the ssize_t problem.. I think that the patch is designed to make *boost* compile fine. Boost compiles fine on my machine. Instead I have problems with programs that *include* boost headers. I cannot compile them As I said when I include the boost python header, a cascade of include ends up including the header that causes the error. Valerio |
Closed by Aaron Griffin (phrakture)
Monday, 03 March 2008, 19:09 GMT
Reason for closing: Works for me
Additional comments about closing: Assuming silence == assent
Monday, 03 March 2008, 19:09 GMT
Reason for closing: Works for me
Additional comments about closing: Assuming silence == assent
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
numeric_vocab.hh:25: error: 'CHAR_BIT' was not declared in this scope
$ sed -n '25p' numeric_vocab.hh
BOOST_STATIC_ASSERT(CHAR_BIT == 8);