Unable to build Plone 5.2 on Ubuntu 20.04.5 (as: unrecognized option '--gdwarf-5')

I am trying to build a Plone instance with Python 3.9, Plone 5.2-latest on Ubuntu 20.04.5.
This throws this error...any idea?

Getting distribution for 'AccessControl==4.3'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
src/AccessControl/cAccessControl.c:428:9: warning: initialization of 'long int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  428 |         NULL,                                   /* tp_print     */
      |         ^~~~
src/AccessControl/cAccessControl.c:428:9: note: (near initialization for 'ZopeSecurityPolicyType.tp_vectorcall_offset')
src/AccessControl/cAccessControl.c:487:9: warning: initialization of 'long int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  487 |         NULL,                                   /* tp_print     */
      |         ^~~~
src/AccessControl/cAccessControl.c:487:9: note: (near initialization for 'SecurityManagerType.tp_vectorcall_offset')
src/AccessControl/cAccessControl.c:546:9: warning: initialization of 'long int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  546 |         NULL,                                   /* tp_print     */
      |         ^~~~
src/AccessControl/cAccessControl.c:546:9: note: (near initialization for 'PermissionRoleType.tp_vectorcall_offset')
src/AccessControl/cAccessControl.c:616:9: warning: initialization of 'long int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  616 |         NULL,                                   /* tp_print     */
      |         ^~~~
src/AccessControl/cAccessControl.c:616:9: note: (near initialization for 'imPermissionRoleType.tp_vectorcall_offset')
src/AccessControl/cAccessControl.c: In function 'c_rolesForPermissionOn':
src/AccessControl/cAccessControl.c:1913:15: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
 1913 |               if (NATIVE_GET_SIZE(roles))
      |               ^~
In file included from /home/ajung/.linuxbrew/opt/python@3.9/include/python3.9/unicodeobject.h:1026,
                 from /home/ajung/.linuxbrew/opt/python@3.9/include/python3.9/Python.h:93,
                 from include/ExtensionClass/ExtensionClass.h:83,
                 from src/AccessControl/cAccessControl.c:49:
/home/ajung/.linuxbrew/opt/python@3.9/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
  446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/AccessControl/cAccessControl.c:1913:15: warning: 'PyUnicode_AsUnicode' is deprecated [-Wdeprecated-declarations]
 1913 |               if (NATIVE_GET_SIZE(roles))
      |               ^~
/home/ajung/.linuxbrew/opt/python@3.9/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
  580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
      |                                             ^~~~~~~~~~~~~~~~~~~
src/AccessControl/cAccessControl.c:1913:15: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
 1913 |               if (NATIVE_GET_SIZE(roles))
      |               ^~
/home/ajung/.linuxbrew/opt/python@3.9/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
  446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
as: unrecognized option '--gdwarf-5'
error: Setup script exited with error: command '/home/ajung/.linuxbrew/bin/gcc-12' failed with exit code 1
An error occurred when trying to install /tmp/tmpfn2olcujget_dist/AccessControl-4.3.tar.gz. Look above this message for any errors that were output by easy_install.
While:
  Installing.
  Getting section wsgi.py.
  Initializing section wsgi.py.
  Installing recipe plone.recipe.zope2instance.
  Getting distribution for 'AccessControl==4.3'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/buildout.py", line 2182, in main
    getattr(buildout, command)(args)
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/buildout.py", line 709, in install
    [self[part]['recipe'] for part in install_parts]
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/buildout.py", line 709, in <listcomp>
    [self[part]['recipe'] for part in install_parts]
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/buildout.py", line 1332, in __getitem__
    options._initialize()
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/buildout.py", line 1440, in _initialize
    self.initialize()
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/buildout.py", line 1446, in initialize
    recipe_class = _install_and_load(reqs, 'zc.buildout', entry, buildout)
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/buildout.py", line 1389, in _install_and_load
    zc.buildout.easy_install.install(
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/easy_install.py", line 963, in install
    return installer.install(specs, working_set)
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/easy_install.py", line 736, in install
    for dist in self._get_dist(req, ws):
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/easy_install.py", line 580, in _get_dist
    dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
  File "/home/ajung/sandboxes/onkopedia_buildout-plone5/lib/python3.9/site-packages/zc/buildout/easy_install.py", line 1751, in _move_to_eggs_dir_and_compile
    [tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: not enough values to unpack (expected 1, got 0)

NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Python 3.9 is officially not supported with Plone 5.2 because of Zope 4 and also not tested im CI afaik.. Zope 5 has patches / fixes for Python 3.9 and upwards and is the foundation for Plone 6.

It might work or have worked, but there are no guarantees that for example the recent Python 3.9 patch versions (which one do you use?) won't introduce new errors when you run this unsupported combination.

Seems like some option is detected and enabled but then all the utilities do not comply.

:zipper_mouth_face: