The -Dbuiltin_xrootd=ON flag works for the master branch. I tried using the same flag for the previous versions (6.14.04, 6.14.06, and 6.16.00) and got the error:
[I] No git repository info found. Trying to interpret VERSION_INFO
[I] src/XrdVersion.hh successfully generated
/opt/cern/root/root_v6.16.00-gcc9/XROOTD-prefix/src/XROOTD/src/XrdXrootd/XrdXrootdProtocol.cc: In member function 'XrdXrootdProtocol XrdXrootdProtocol::operator=(const XrdXrootdProtocol&)':
/opt/cern/root/root_v6.16.00-gcc9/XROOTD-prefix/src/XROOTD/src/XrdXrootd/XrdXrootdProtocol.cc:234:12: error: implicitly-declared 'XrdXrootdProtocol::XrdXrootdProtocol(XrdXrootdProtocol&)' is deprecated [-Werror=deprecated-copy]
234 | return *this;
| ^~~~
/opt/cern/root/root_v6.16.00-gcc9/XROOTD-prefix/src/XROOTD/src/XrdXrootd/XrdXrootdProtocol.cc:215:19: note: because 'XrdXrootdProtocol' has user-provided 'XrdXrootdProtocol XrdXrootdProtocol::operator=(const XrdXrootdProtocol&)'
215 | XrdXrootdProtocol XrdXrootdProtocol::operator =(const XrdXrootdProtocol &rhs)
| ^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/XrdServer.dir/XrdXrootd/XrdXrootdProtocol.cc.o] Error 1
make[4]: *** [src/CMakeFiles/XrdServer.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [all] Error 2
So I tried using the -Dxrootd=OFF flag instead, and this works for all three versions.
So to recap, compiling on CentOS 6 with a custom gcc 9.1 requires the use of -Dsqlite=OFF
as well as -Dxrootd=OFF
for all older versions and -Dbuiltin_xrootd=ON
for the newest version.