Menu

#53 Build error: ‘PyModuleDef’ not declared

v1.0 (example)
open
nobody
None
5
2020-08-11
2020-08-10
Anonymous
No

Golly built from dev sources, git ID 4baa4ad405a09d284c025b4ea25770afbcc32627

GCC version 10.1.0
Linux kernel version 5.4.52
Python3 version 3.8.3
Python2 version 2.7.18

No extra configure options to Golly. Default build:
The wxWidgets build which will be used by golly 3.5b1
has the following settings:

  • RELEASE build
  • UNICODE mode
  • SHARED mode
  • VERSION: 3.0.5
  • PORT: gtk2

Build errors as follows:

g++ -DPACKAGE_NAME=\"golly\" -DPACKAGE_TARNAME=\"golly\" -DPACKAGE_VERSION=\"3.5b1\" -DPACKAGE_STRING=\"golly\ 3.5b1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_STDLIB_H=1 -DHAVE_REALLOC=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_MEMSET=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRRCHR=1 -DHAVE_WX_BMP_HANDLER=1 -DHAVE_WX_GIF_HANDLER=1 -DHAVE_WX_PNG_HANDLER=1 -DHAVE_WX_TIFF_HANDLER=1 -DPYTHON_SHLIB=libpython2.7.so -DZLIB=1 -DVERSION=3.5b1 -I. -I../gui-wx/configure -I../gui-wx/configure/../../gollybase/ -I/usr/lib/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -I'/usr/include/python2.7' -DLUA_USE_LINUX -I../gui-wx/configure/../../lua -DGOLLYDIR="/usr/local/share/golly" -Wall -fno-strict-aliasing -O3 -march=znver2 -pipe -MT golly-wxpython.o -MD -MP -MF .deps/golly-wxpython.Tpo -c -o golly-wxpython.o test -f '../../gui-wx/wxpython.cpp' || echo '../gui-wx/configure/'../../gui-wx/wxpython.cpp
../gui-wx/configure/../../gui-wx/wxpython.cpp:118:36: error: ‘PyModuleDef’ was not declared in this scope; did you mean ‘PyModule_New’?
118 | PyObject(G_PyModule_Create2)(PyModuleDef, int) = NULL;
| ^~~~~~~~~~~
| PyModule_New
../gui-wx/configure/../../gui-wx/wxpython.cpp:118:48: error: expected primary-expression before ‘,’ token
118 | PyObject
(G_PyModule_Create2)(PyModuleDef, int) = NULL;
| ^
../gui-wx/configure/../../gui-wx/wxpython.cpp:118:50: error: expected primary-expression before ‘int’
118 | PyObject(G_PyModule_Create2)(PyModuleDef, int) = NULL;
| ^~~
../gui-wx/configure/../../gui-wx/wxpython.cpp:118:53: error: expression list treated as compound expression in initializer [-fpermissive]
118 | PyObject
(G_PyModule_Create2)(PyModuleDef, int) = NULL;
| ^
../gui-wx/configure/../../gui-wx/wxpython.cpp:3167:8: error: ‘PyModuleDef’ does not name a type; did you mean ‘PyModule_New’?
3167 | static PyModuleDef py_module = {
| ^~~~~~~~~~~
| PyModule_New
../gui-wx/configure/../../gui-wx/wxpython.cpp: In function ‘PyObject* PyInit_golly()’:
../gui-wx/configure/../../gui-wx/wxpython.cpp:3180:29: error: ‘py_module’ was not declared in this scope
3180 | return PyModule_Create(&py_module);
| ^~~~~~~~~
../gui-wx/configure/../../gui-wx/wxpython.cpp:3180:12: error: ‘PyModule_Create’ was not declared in this scope; did you mean ‘PyModule_Create2’?
3180 | return PyModule_Create(&py_module);
| ^~~~~~~~~~~~~~~
| PyModule_Create2
../gui-wx/configure/../../gui-wx/wxpython.cpp: At global scope:
../gui-wx/configure/../../gui-wx/wxpython.cpp:3049:20: warning: ‘py_methods’ defined but not used [-Wunused-variable]
3049 | static PyMethodDef py_methods[] = {
| ^~~~~~~~~~
make: *** [Makefile:2464: golly-wxpython.o] Error 1

Discussion

  • Andrew Trevorrow

    Try upgrading Python to version 3.8.5 and let us know if that fixes the problem.
    (We're currently investigating using Python's stable API calls in wxpython.cpp, so hopefully that will avoid these sort of problems in future.)

     
  • Andrew Trevorrow

    The real problem is the "-DPYTHON_SHLIB=libpython2.7.so". Make sure your local-gtk.mk file has PYTHON = python3 so that it will find libpython3.8.so.

     
MongoDB Logo MongoDB