The samba FTBFS is blocking the python 3.8 transition in raspbian bullseye, so I decided to take a look.
error: Unable to determine origin of type `struct cli_credentials'
I don't think this is the error that is causing the build failure. The same error can be seen in succesful build logs. e.g. https://buildd.debian.org/status/fetch.php?pkg=samba&arch=amd64&ver=2%3A4.11.5%2Bdfsg-1%2Bb1&stamp=1583775414&raw=0 Instead I think the real error is further down the log
../../lib/replace/system/network.h:91:10: fatal error: stropts.h: No such file or directory
Some googling lead me to https://bugs.gentoo.org/699668 and https://bugzilla.samba.org/show_bug.cgi?id=14100 which suggests that the bug triggers if samba is built against a newer glibc while python was built against an older glibc. Specifically it seems python headers leak certain system feature defines including HAVE_STROPTS_H which cause network.h to think stropts.h is available when it isn't. If my understanding is correct I see two possible ways forward. 1. Rebuild python3.8 against the new glibc. 2. Remove the stropts include from samba, it doesn't seem to actually be used for anything (at least I can't find any other references to HAVE_STROPTS_H in the code). I am currently testing a build in raspbian bullseye with the second approach. I will report back later on whether it results in a succesful build.