Python 3.12 build on Raspberry Pi 4 Bullseye

Running Debian GNU/Linux 11 (bullseye), downloaded source and ran ./configure --enable-optimizations which seemed ok. However make -j4 fails towards the end with missing modules:

make[1]: Entering directory '/home/pi/Python-3.12.0'
The necessary bits to build these optional modules were not found:
_dbm                  _lzma     

I have done the appropriate Install Dependencies from https://devguide.python.org/getting-started/setup-building/#build-dependencies but to no avail. Can someone point me in the right direction to find the missing bits.

I don’t know if this is relevant but I’m currently on Python 3.9.2 (the default for Bullseye), building 3.11.6 works fine.

I do not specifics, but usually it a matter of checking what ./configure says it cannot find.
There should be messages related to lzma and dbm in the output.

Alternatively find the .deb source for python in debian and see what deps are lusted.