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
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Andreas Radke (AndyRTR)
Isenmann Daniel (ise)
Architecture x86_64
Severity High
Priority Normal
Reported Version 0.7.2 Gimmick
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

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
Comment by Valerio Mariani (valmar) - Saturday, 31 March 2007, 13:36 GMT
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


Comment by Aaron Griffin (phrakture) - Monday, 21 May 2007, 17:49 GMT
Bug reappears in newest boost. It appears the patch was not applied (or failed?) - can someone verify?
Comment by Dennis (vitalstatistix) - Tuesday, 22 May 2007, 16:36 GMT
monotone (mtn) cannot compile as well due to, if I infer correctly, boost size issues:

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);
Comment by Roman Kyrylych (Romashka) - Tuesday, 22 May 2007, 18:56 GMT
new bug collector here: http://bugs.archlinux.org/task/7217 (3 newer bug reports closed in favour of that one)
Comment by Kevin Piche (kpiche) - Wednesday, 23 May 2007, 02:00 GMT
ssize_t patch was removed for x86_64 in rev 1.17
Comment by Kevin Piche (kpiche) - Wednesday, 23 May 2007, 02:40 GMT
The CHAR_BIT problem should be solved by including <limits.h>. Nevermind. Monotone is also having problems with std::min, std::max, std::numeric_limits and my C++ sucks...
Comment by Roman Kyrylych (Romashka) - Saturday, 09 February 2008, 16:14 GMT
status on this?
Comment by Andreas Radke (AndyRTR) - Saturday, 01 March 2008, 17:54 GMT
I vote for closing this one. Not much we can do here.

Loading...