Ok, thanks for the reply. I will investigate about how to do that.
Anyway I have tried what documentation says about “Remove compatibility checks”:
https://docs.blender.org/manual/en/latest/render/cycles/gpu_rendering.html#unsupported-gnu-version-gcc-4-7-and-up-are-not-supported
My file is in “/usr/local/cuda/include/crt/” and the related line is “#error – unsupported GNU version! gcc versions later than 8 are not supported!” (CUDA 10.2 installed from run file). I have removed that line and CUDA kernel is compiled with gcc9 without giving the error message. Cycles GPU only works correctly, but I still have the aforementioned problem about CPU+GPU rendering. CPU+GPU rendering is working correctly in buildbot builds. My CPU is i7-3770 and GPU a GTX 960.
About gcc version problem. Is there anything that can be done by Blender devs to avoid this compatibility error? Soon Ubuntu 20.04 will be released and I suspect that many users who want to build blender will have that problem.