Nico Kadel-Garcia
2010-Aug-22 16:14 UTC
[Samba] Difficulty compiling 4.0.0alpha11 on RHEL 5, "Py_ssize_t" undeclared in net.c
Line 59 of samba4.0.0-alpha11/source4/utils/net.c file, at line 59
uses "Py_ssize_t", which was not defined in Python until Python 2.5.
This causes havoc trying to compile it on RHEL 5, which uses Python
2.4 and which I cannot recommend upgrading the Python for in a
production server environment. (I've tried that: it causes dependency
hell in RHEL.)
So, I suggest adding this patch to allow successful compilation with
older RHEL versions. The code is duplicated from wml_wrap.c, and seems
to behave correctly in my casual testing.
--- samba-4.0.0alpha11/source4/utils/net/net.c.oldpython 2010-01-11
00:35:28.000000000 -0500
+++ samba-4.0.0alpha11/source4/utils/net/net.c 2010-08-22
11:44:59.000000000 -0400
@@ -52,6 +52,15 @@
#include <Python.h>
#include "scripting/python/modules.h"
+/* Py_ssize_t for old Pythons */
+/* This code is as recommended by: */
+/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+# define PY_SSIZE_T_MAX INT_MAX
+# define PY_SSIZE_T_MIN INT_MIN
+#endif
+
static PyObject *py_tuple_from_argv(int argc, const char *argv[])
{
PyObject *l;
Michael Wood
2010-Aug-22 17:00 UTC
[Samba] Difficulty compiling 4.0.0alpha11 on RHEL 5, "Py_ssize_t" undeclared in net.c
On 22 August 2010 18:14, Nico Kadel-Garcia <nkadel at gmail.com> wrote:> Line 59 of samba4.0.0-alpha11/source4/utils/net.c file, at line 59 > uses "Py_ssize_t", which was not defined in Python until Python 2.5. > This causes havoc trying to compile it on RHEL 5, which uses Python > 2.4 and which I cannot recommend upgrading the Python for in a > production server environment. (I've tried that: it causes dependency > hell in RHEL.) > > So, I suggest adding this patch to allow successful compilation with > older RHEL versions. The code is duplicated from wml_wrap.c, and seems > to behave correctly in my casual testing.samba-technical is a better list for this sort of thing. By the way, there have been other Python 2.4 compatibility problems as well, e.g. with provision, if I remember correctly, but perhaps not with alpha11. If your problem still exists with the latest version from GIT, I suggest you provide a patch for that and then post it to samba-technical.> --- samba-4.0.0alpha11/source4/utils/net/net.c.oldpython ? ? ? ?2010-01-11 > 00:35:28.000000000 -0500 > +++ samba-4.0.0alpha11/source4/utils/net/net.c ?2010-08-22 > 11:44:59.000000000 -0400 > @@ -52,6 +52,15 @@ > ?#include <Python.h> > ?#include "scripting/python/modules.h" > > +/* Py_ssize_t for old Pythons */ > +/* This code is as recommended by: */ > +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ > +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) > +typedef int Py_ssize_t; > +# define PY_SSIZE_T_MAX INT_MAX > +# define PY_SSIZE_T_MIN INT_MIN > +#endif > + > ?static PyObject *py_tuple_from_argv(int argc, const char *argv[]) > ?{ > ? ? ? ?PyObject *l;-- Michael Wood <esiotrot at gmail.com>