Hi Serena,
and welcome to the ROOT forum!
As per the compilation error, can you also copy-paste the contents of /usr/local/root-6.22.02-build/XROOTD-prefix/src/XROOTD-stamp/XROOTD-build-*.log
please?
Note that unless you have a special reason for compiling ROOT from source, you can install ROOT 6.22.02 on Mac 10.15 without compiling following one of the installation methods mentioned at https://root.cern/install .
Also see this post about embedding code in forum posts.
Cheers,
Enrico