#error -- unsupported GNU version! gcc versions later than 8 are not supported!


Recently I have installed Ubuntu 20.04.4 LTS as a subsystem on Windows 10 machine to work with OptiX API. I did:

  • updated my graphics driver first

  • installed the latest CUDA and set the directory to my PATH from the tutorial

    • echo “PATH=$PATH:/usr/local/cuda-11.6” >> ~/.bashrc
    • echo “LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/cuda-11.6/targets/x86_64-linux/lib” >> ~/.bashrc
    • source ~/.bashrc
  • set environment variable OptiX_INSTALL_DIR

In addition, the system has:

  • gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
  • g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

However (I guess here is the problem) ,

  • The nvidia--smi shows: NVIDIA-SMI 510.47.03 Driver Version: 510.47.03 CUDA Version: 11.6
  • But the nvcc --version showing: Cuda compilation tools, release 10.1, V10.1.243

So, while I was trying to BUILD the optix7course, it is returning me this error (below), same error occurs for BUILD default OptiX examples:

In file included from /usr/include/cuda_runtime.h:83,
                 from <command-line>:
/usr/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!
  138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
      |  ^~~~~
CMake Error at cuda_compile_ptx_1_generated_devicePrograms.cu.ptx.Release.cmake:212 (message):
  Error generating

make[2]: *** [example02_pipelineAndRayGen/CMakeFiles/ex02_pipelineAndRayGen.dir/build.make:69: example02_pipelineAndRayGen/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx] Error 1
make[1]: *** [CMakeFiles/Makefile2:445: example02_pipelineAndRayGen/CMakeFiles/ex02_pipelineAndRayGen.dir/all] Error 2

I would sincerely appreciate if someone had similar problem and suggest me a solution.

I think you’ve identified the problem - a too-early version of nvcc is being invoked (and sure enough, from this link, 10.1 won’t support gcc versions > 8).

My first guess would be that you’re picking up an earlier version of nvcc in your PATH - you could run which nvcc to see the path to the nvcc that you’re actually running, and I’d guess it’s not the directory you expect. You could also try explicitly running /usr/local/cuda-11.6/bin/nvcc against a file and double checking that it works with the later gcc to verify that the new nvcc would work.

If that seems to work, then I’d say there’s two things going on here - one is that the line “PATH=$PATH:/usr/local/cuda-11.6” adds the new CUDA directory to the end of the PATH, so if there was already a directory earlier in your PATH that pointed to the older nvcc, that’s what would get picked up first. Also, at least on my install, nvcc is in /usr/local/cuda-11.6/bin, not just ../cuda-11.6 so that it’s probably not seeing the new nvcc at all. (I also think the library path is missing a local: e.g. /usr/local/cuda-11.6 vs /usr/cuda-11.6.)

Does that help?

1 Like

Thanks @jdursi , problem almost solved. However, it leads to another BUILD ERROR, BIN2C NOT FOUND. Editing the CMakeCache.txt manually BIN2C:FILEPATH=/usr/local/cuda-11.6/bin/bin2c solved the problem. Problem Solved and running.

1 Like

Glad to hear it!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.