I picked that from the third link I posted.
I’m guessing there is an entry for path to Cuda compiler in the CMakeCache.txt file in the build folder. If it points to gcc-9, change the path manually to 8.
If doesn’t work, try the second link (last post in that thread) or the fourth one which use symlink
ln -sf /usr/bin/gcc-8 /usr/local/cuda/bin/gcc