Is there a patch somewhere I need to apply? Here's the error I get:
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DMAX_ML_REPLY=32 -I/usr/include/python3.6m -c miltermodule.c -o build/temp.linux-x86_64-3.6/miltermodule.o
miltermodule.c:346:14: error: expected ';' before 'struct'
staticforward struct smfiDesc description; / forward declaration /
^~~
;
miltermodule.c:358:1: error: unknown type name 'staticforward'; did you mean 'static_assert'?
staticforward PyTypeObject milter_ContextType;
^~~~~
static_assert
miltermodule.c:358:28: error: expected '=', ',', ';', 'asm' or 'attribute' before 'milter_ContextType'
staticforward PyTypeObject milter_ContextType;
^~~~~~
In file included from /usr/include/python3.6m/Python.h:81,
from miltermodule.c:259:
miltermodule.c: In function '_get_context':
miltermodule.c:383:47: error: 'milter_ContextType' undeclared (first use in this function); did you mean 'milter_ContextObject'?
self = PyObject_New(milter_ContextObject,&milter_ContextType);
^~~~~~
/usr/include/python3.6m/objimpl.h:137:42: note: in definition of macro 'PyObject_New'
( (type ) _PyObject_New(typeobj) )
^~~
miltermodule.c:383:47: note: each undeclared identifier is reported only once for each function it appears in
self = PyObject_New(milter_ContextObject,&milter_ContextType);
^~~~~~
/usr/include/python3.6m/objimpl.h:137:42: note: in definition of macro 'PyObject_New'
( (type ) _PyObject_New(typeobj) )
^~~
miltermodule.c: In function '_find_context':
miltermodule.c:410:22: error: 'milter_ContextType' undeclared (first use in this function); did you mean 'milter_ContextObject'?
if (c->ob_type == &milter_ContextType) {
^~~~~~
milter_ContextObject
miltermodule.c: In function '_generic_wrapper':
miltermodule.c:703:8: warning: implicit declaration of function 'PyInt_Check'; did you mean 'PySet_Check'? [-Wimplicit-function-declaration]
if (!PyInt_Check(result)) {
^~~
PySet_Check
miltermodule.c:718:12: warning: implicit declaration of function 'PyInt_AS_LONG'; did you mean 'PyLong_AS_LONG'? [-Wimplicit-function-declaration]
retval = PyInt_AS_LONG(result);
^~~~~
PyLong_AS_LONG
miltermodule.c: In function 'makeipaddr':
miltermodule.c:735:9: warning: implicit declaration of function 'PyString_FromString'; did you mean 'PyLong_FromString'? [-Wimplicit-function-declaration]
return PyString_FromString(buf);
^~~~~~~
PyLong_FromString
miltermodule.c:735:9: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion]
return PyString_FromString(buf);
^~~~~~~~
miltermodule.c: In function 'makeip6addr':
miltermodule.c:743:16: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion]
if (s) return PyString_FromString(s);
^~~~~~
miltermodule.c:744:9: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion]
return PyString_FromString("inet6:unknown");
^~~~~~~~
miltermodule.c: In function 'generic_env_wrapper':
miltermodule.c:835:20: warning: implicit declaration of function 'PyString_FromStringAndSize'; did you mean 'PyBytes_FromStringAndSize'? [-Wimplicit-function-declaration]
PyObject o = PyString_FromStringAndSize(argv[i], strlen(argv[i]));
^~~~~~
PyBytes_FromStringAndSize
miltermodule.c:835:20: warning: initialization of 'PyObject ' {aka 'struct _object '} from 'int' makes pointer from integer without a cast [-Wint-conversion]
miltermodule.c: In function 'milter_wrap_negotiate':
miltermodule.c:966:10: warning: implicit declaration of function 'PyInt_AsUnsignedLongMask'; did you mean 'PyLong_AsUnsignedLongMask'? [-Wimplicit-function-declaration]
? PyInt_AsUnsignedLongMask(PyList_GET_ITEM(optlist,i))
^~~~~~~~
PyLong_AsUnsignedLongMask
miltermodule.c: In function 'milter_Context_getattr':
miltermodule.c:1556:10: warning: implicit declaration of function 'Py_FindMethod'; did you mean 'Py_tp_methods'? [-Wimplicit-function-declaration]
return Py_FindMethod(context_methods, self, name);
^~~~~
Py_tp_methods
miltermodule.c:1556:10: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion]
return Py_FindMethod(context_methods, self, name);
^~~~~~~~~~
miltermodule.c: At top level:
miltermodule.c:1559:24: error: static declaration of 'description' follows non-static declaration
static struct smfiDesc description = { / Set some reasonable defaults /
^~~
miltermodule.c:346:31: note: previous declaration of 'description' was here
staticforward struct smfiDesc description; / forward declaration /
^~~
miltermodule.c:1606:42: warning: missing braces around initializer [-Wmissing-braces]
static PyTypeObject milter_ContextType = {
^
miltermodule.c:1609:3: warning: initialization of 'long int' from 'char ' makes integer from pointer without a cast [-Wint-conversion]
"milterContext",
^~~~~~~
miltermodule.c:1609:3: note: (near initialization for 'milter_ContextType.tp_basicsize')
miltermodule.c:1612:9: warning: initialization of 'int ()(PyObject , FILE , int)' {aka 'int ()(struct _object , struct _IO_FILE , int)'} from incompatible pointer type 'void ()(PyObject )' {aka 'void ()(struct _object )'} [-Wincompatible-pointer-types]
milter_Context_dealloc, / tp_dealloc /
^~~~~~
miltermodule.c:1612:9: note: (near initialization for 'milter_ContextType.tp_print')
miltermodule.c:1614:9: warning: initialization of 'int ()(PyObject , char , PyObject )' {aka 'int ()(struct _object , char , struct _object )'} from incompatible pointer type 'PyObject ()(PyObject , char )' {aka 'struct _object ()(struct _object , char )'} [-Wincompatible-pointer-types]
milter_Context_getattr, / tp_getattr /
^~~~~~
miltermodule.c:1614:9: note: (near initialization for 'milter_ContextType.tp_setattr')
In file included from /usr/include/python3.6m/pytime.h:6,
from /usr/include/python3.6m/Python.h:77,
from miltermodule.c:259:
/usr/include/python3.6m/object.h:659:29: warning: initialization of 'const char *' from 'long unsigned int' makes pointer from integer without a cast [-Wint-conversion]
define Py_TPFLAGS_DEFAULT ( \
^
miltermodule.c:1627:9: note: in expansion of macro 'Py_TPFLAGS_DEFAULT'
Py_TPFLAGS_DEFAULT, / tp_flags /
^~~~~~
/usr/include/python3.6m/object.h:659:29: note: (near initialization for 'milter_ContextType.tp_doc')
define Py_TPFLAGS_DEFAULT ( \
^
miltermodule.c:1627:9: note: in expansion of macro 'Py_TPFLAGS_DEFAULT'
Py_TPFLAGS_DEFAULT, / tp_flags /
^~~~~~
miltermodule.c:1606:42: warning: missing braces around initializer [-Wmissing-braces]
static PyTypeObject milter_ContextType = {
^
miltermodule.c: In function 'setitem':
miltermodule.c:1637:17: warning: implicit declaration of function 'PyInt_FromLong'; did you mean 'PyLong_FromLong'? [-Wimplicit-function-declaration]
PyObject v = PyInt_FromLong(val);
^~~~~~
PyLong_FromLong
miltermodule.c:1637:17: warning: initialization of 'PyObject ' {aka 'struct _object '} from 'int' makes pointer from integer without a cast [-Wint-conversion]
miltermodule.c: In function 'initmilter':
miltermodule.c:1646:8: warning: implicit declaration of function 'Py_InitModule4'; did you mean 'Py_Initialize'? [-Wimplicit-function-declaration]
m = Py_InitModule4("milter", milter_methods, milter_documentation,
^~~~~~
Py_Initialize
miltermodule.c:1646:6: warning: assignment to 'PyObject ' {aka 'struct _object '} from 'int' makes pointer from integer without a cast [-Wint-conversion]
m = Py_InitModule4("milter", milter_methods, milter_documentation,
^
At top level:
miltermodule.c:1606:21: warning: 'milter_ContextType' defined but not used [-Wunused-variable]
static PyTypeObject milter_ContextType = {
^~~~~~
miltermodule.c:1559:24: warning: 'description' defined but not used [-Wunused-variable]
static struct smfiDesc description = { / Set some reasonable defaults */
^~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
ro
Is there a patch somewhere I need to apply? Here's the error I get:
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DMAX_ML_REPLY=32 -I/usr/include/python3.6m -c miltermodule.c -o build/temp.linux-x86_64-3.6/miltermodule.o miltermodule.c:346:14: error: expected ';' before 'struct' staticforward struct smfiDesc description; / forward declaration / ^
~~ ; miltermodule.c:358:1: error: unknown type name 'staticforward'; did you mean 'static_assert'? staticforward PyTypeObject milter_ContextType; ^~~~~ static_assert miltermodule.c:358:28: error: expected '=', ',', ';', 'asm' or 'attribute' before 'milter_ContextType' staticforward PyTypeObject milter_ContextType; ^~~~~~ In file included from /usr/include/python3.6m/Python.h:81, from miltermodule.c:259: miltermodule.c: In function '_get_context': miltermodule.c:383:47: error: 'milter_ContextType' undeclared (first use in this function); did you mean 'milter_ContextObject'? self = PyObject_New(milter_ContextObject,&milter_ContextType); ^~~~~~ /usr/include/python3.6m/objimpl.h:137:42: note: in definition of macro 'PyObject_New' ( (type ) _PyObject_New(typeobj) ) ^~~ miltermodule.c:383:47: note: each undeclared identifier is reported only once for each function it appears in self = PyObject_New(milter_ContextObject,&milter_ContextType); ^~~~~~ /usr/include/python3.6m/objimpl.h:137:42: note: in definition of macro 'PyObject_New' ( (type ) _PyObject_New(typeobj) ) ^~~ miltermodule.c: In function '_find_context': miltermodule.c:410:22: error: 'milter_ContextType' undeclared (first use in this function); did you mean 'milter_ContextObject'? if (c->ob_type == &milter_ContextType) { ^~~~~~ milter_ContextObject miltermodule.c: In function '_generic_wrapper': miltermodule.c:703:8: warning: implicit declaration of function 'PyInt_Check'; did you mean 'PySet_Check'? [-Wimplicit-function-declaration] if (!PyInt_Check(result)) { ^~~PySet_Check miltermodule.c:718:12: warning: implicit declaration of function 'PyInt_AS_LONG'; did you mean 'PyLong_AS_LONG'? [-Wimplicit-function-declaration] retval = PyInt_AS_LONG(result); ^~~~~ PyLong_AS_LONG miltermodule.c: In function 'makeipaddr': miltermodule.c:735:9: warning: implicit declaration of function 'PyString_FromString'; did you mean 'PyLong_FromString'? [-Wimplicit-function-declaration] return PyString_FromString(buf); ^~~~~~~ PyLong_FromString miltermodule.c:735:9: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion] return PyString_FromString(buf); ^~~~~~~~ miltermodule.c: In function 'makeip6addr': miltermodule.c:743:16: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion] if (s) return PyString_FromString(s); ^~~~~~ miltermodule.c:744:9: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion] return PyString_FromString("inet6:unknown"); ^~~~~~~~miltermodule.c: In function 'generic_env_wrapper': miltermodule.c:835:20: warning: implicit declaration of function 'PyString_FromStringAndSize'; did you mean 'PyBytes_FromStringAndSize'? [-Wimplicit-function-declaration] PyObject o = PyString_FromStringAndSize(argv[i], strlen(argv[i])); ^~~~~~PyBytes_FromStringAndSize miltermodule.c:835:20: warning: initialization of 'PyObject ' {aka 'struct _object '} from 'int' makes pointer from integer without a cast [-Wint-conversion] miltermodule.c: In function 'milter_wrap_negotiate': miltermodule.c:966:10: warning: implicit declaration of function 'PyInt_AsUnsignedLongMask'; did you mean 'PyLong_AsUnsignedLongMask'? [-Wimplicit-function-declaration] ? PyInt_AsUnsignedLongMask(PyList_GET_ITEM(optlist,i)) ^~~~~~~~ PyLong_AsUnsignedLongMask miltermodule.c: In function 'milter_Context_getattr': miltermodule.c:1556:10: warning: implicit declaration of function 'Py_FindMethod'; did you mean 'Py_tp_methods'? [-Wimplicit-function-declaration] return Py_FindMethod(context_methods, self, name); ^~~~~ Py_tp_methods miltermodule.c:1556:10: warning: returning 'int' from a function with return type 'PyObject ' {aka 'struct _object '} makes pointer from integer without a cast [-Wint-conversion] return Py_FindMethod(context_methods, self, name); ^~~~~~~~~~ miltermodule.c: At top level: miltermodule.c:1559:24: error: static declaration of 'description' follows non-static declaration static struct smfiDesc description = { / Set some reasonable defaults / ^~~miltermodule.c:346:31: note: previous declaration of 'description' was here staticforward struct smfiDesc description; / forward declaration / ^~~miltermodule.c:1606:42: warning: missing braces around initializer [-Wmissing-braces] static PyTypeObject milter_ContextType = { ^ miltermodule.c:1609:3: warning: initialization of 'long int' from 'char ' makes integer from pointer without a cast [-Wint-conversion] "milterContext", ^~~~~~~ miltermodule.c:1609:3: note: (near initialization for 'milter_ContextType.tp_basicsize') miltermodule.c:1612:9: warning: initialization of 'int ()(PyObject , FILE , int)' {aka 'int ()(struct _object , struct _IO_FILE , int)'} from incompatible pointer type 'void ()(PyObject )' {aka 'void ()(struct _object )'} [-Wincompatible-pointer-types] milter_Context_dealloc, / tp_dealloc / ^~~~~~ miltermodule.c:1612:9: note: (near initialization for 'milter_ContextType.tp_print') miltermodule.c:1614:9: warning: initialization of 'int ()(PyObject , char , PyObject )' {aka 'int ()(struct _object , char , struct _object )'} from incompatible pointer type 'PyObject ()(PyObject , char )' {aka 'struct _object ()(struct _object , char )'} [-Wincompatible-pointer-types] milter_Context_getattr, / tp_getattr / ^~~~~~ miltermodule.c:1614:9: note: (near initialization for 'milter_ContextType.tp_setattr') In file included from /usr/include/python3.6m/pytime.h:6, from /usr/include/python3.6m/Python.h:77, from miltermodule.c:259: /usr/include/python3.6m/object.h:659:29: warning: initialization of 'const char *' from 'long unsigned int' makes pointer from integer without a cast [-Wint-conversion]define Py_TPFLAGS_DEFAULT ( \
miltermodule.c:1627:9: note: in expansion of macro 'Py_TPFLAGS_DEFAULT' Py_TPFLAGS_DEFAULT, / tp_flags / ^
~~~~~ /usr/include/python3.6m/object.h:659:29: note: (near initialization for 'milter_ContextType.tp_doc')define Py_TPFLAGS_DEFAULT ( \
miltermodule.c:1627:9: note: in expansion of macro 'Py_TPFLAGS_DEFAULT' Py_TPFLAGS_DEFAULT, / tp_flags / ^
~~~~~ miltermodule.c:1606:42: warning: missing braces around initializer [-Wmissing-braces] static PyTypeObject milter_ContextType = { ^ miltermodule.c: In function 'setitem': miltermodule.c:1637:17: warning: implicit declaration of function 'PyInt_FromLong'; did you mean 'PyLong_FromLong'? [-Wimplicit-function-declaration] PyObject v = PyInt_FromLong(val); ^~~~~~ PyLong_FromLong miltermodule.c:1637:17: warning: initialization of 'PyObject ' {aka 'struct _object '} from 'int' makes pointer from integer without a cast [-Wint-conversion] miltermodule.c: In function 'initmilter': miltermodule.c:1646:8: warning: implicit declaration of function 'Py_InitModule4'; did you mean 'Py_Initialize'? [-Wimplicit-function-declaration] m = Py_InitModule4("milter", milter_methods, milter_documentation, ^~~~~~ Py_Initialize miltermodule.c:1646:6: warning: assignment to 'PyObject ' {aka 'struct _object '} from 'int' makes pointer from integer without a cast [-Wint-conversion] m = Py_InitModule4("milter", milter_methods, milter_documentation, ^ At top level: miltermodule.c:1606:21: warning: 'milter_ContextType' defined but not used [-Wunused-variable] static PyTypeObject milter_ContextType = { ^~~~~~ miltermodule.c:1559:24: warning: 'description' defined but not used [-Wunused-variable] static struct smfiDesc description = { / Set some reasonable defaults */ ^~~error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ro