Cannot build on macOS 12

Using “pip install -U wxPython” on macOS 12.0.1 starts building but errors. Is this the troublesome parts of the log? Any ideas? Thanks!

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DNANOSVG_IMPLEMENTATION=1 -DNANOSVGRAST_IMPLEMENTATION=1 -DNANOSVG_ALL_COLOR_KEYWORDS=1 -Iext/nanosvg/src -I/Users/stevehartford/Documents/Minecraft/Amulet-VM/tutorial-env/include -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c wx/svg/_nanosvg.c -o build/wxsvg/temp.macosx-10.9-universal2-3.10/wx/svg/_nanosvg.o
wx/svg/_nanosvg.c:5761:72: warning: array subscript is of type 'char' [-Wchar-subscripts]
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_self->_ptr->strokeDashArray[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
                                                                       ^~~~~~~~~~
wx/svg/_nanosvg.c:20946:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                  ^
wx/svg/_nanosvg.c:20946:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wx/svg/_nanosvg.c:20951:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                  ^
wx/svg/_nanosvg.c:20951:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wx/svg/_nanosvg.c:21035:19: error: implicit declaration of function '_PyGen_Send' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            ret = _PyGen_Send((PyGenObject*)yf, NULL);
                  ^
wx/svg/_nanosvg.c:21035:17: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
            ret = _PyGen_Send((PyGenObject*)yf, NULL);
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings and 3 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
Command '/Users/stevehartford/Documents/Minecraft/Amulet-VM/tutorial-env/bin/python setup-wxsvg.py build_ext --inplace' failed with exit code 1.
Finished command: build_others (0.257s)
Finished command: build_py (2m15.248s)
Finished command: build (3m54.74s)
Command '"/Users/stevehartford/Documents/Minecraft/Amulet-VM/tutorial-env/bin/python" -u build.py build' failed with exit code 1.

Yeah, that’s a Python 3.10 issue that’s been fixed in the master branch
but not yet released:

You could perhaps try Python 3.9 for now, or apply that patch yourself?
Or build the master branch?

Scott

Python 3.10.1 has just been released. It would be awesome to have a wxPython release that supports Python 3.10 and latest wxWidgets.

An updated wxWidgets has been on the wish list for a very long time. Would be a good time to kill two birds with one stone :wink:

Working build steps for the above issue:

  • brew install doxygen #dependency for build step below
  • git clone https://github.com/wxWidgets/Phoenix.git && cd Phoenix
  • git checkout wxPython-4.1.1
  • git cherrypick b40ab0f806bdf7aa0c0a51a8c4876ac47754515d #cherry-pick commit for resolving above python 3.10 issue
  • git submodule update --init —recursive
  • export CXXFLAGS=-I$(brew --prefix)/include
  • python3 build.py dox etg --nodoc sip build
  • python3 setup.py install