Compiling CUDA 9.0 Samples on Ubuntu 16.04 has error

I am on Ubuntu 16.04. When I attempt to compile the CUDA samples here is the error message

cd NVIDIA_CUDA-9.0_Samples
make

make[1]: Entering directory '/home/jasjuang/NVIDIA_CUDA-9.0_Samples/3_Imaging/EGLStream_CUDA_CrossGPU'
"/usr/local/cuda-9.0"/bin/nvcc -ccbin g++ -I../../common/inc  -m64    -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -o eglstrm_common.c.o -c eglstrm_common.c
eglstrm_common.c: In function ‘EGLStreamInit’:
eglstrm_common.c:85:81: error: ‘EGL_SUPPORT_REUSE_NV’ undeclared (first use in this function)
     static const EGLint streamAttrFIFOMode[] = { EGL_STREAM_FIFO_LENGTH_KHR, 5, EGL_SUPPORT_REUSE_NV, EGL_FALSE, EGL_NONE };
                                                                                 ^
eglstrm_common.c:85:81: note: each undeclared identifier is reported only once for each function it appears in
Makefile:339: recipe for target 'eglstrm_common.c.o' failed
make[1]: *** [eglstrm_common.c.o] Error 1
make[1]: Leaving directory '/home/jasjuang/NVIDIA_CUDA-9.0_Samples/3_Imaging/EGLStream_CUDA_CrossGPU'
Makefile:52: recipe for target '3_Imaging/EGLStream_CUDA_CrossGPU/Makefile.ph_build' failed
make: *** [3_Imaging/EGLStream_CUDA_CrossGPU/Makefile.ph_build] Error 2

and then I googled the keyword EGL_SUPPORT_REUSE_NV
and realize this keyword is part of eglext.h as indicated in https://www.khronos.org/registry/EGL/api/EGL/eglext.h. In my machine, there is a eglext.h at /usr/include/EGL/eglext.h, however when I inspect it, it appears to be an older version of eglext.h that does not have the keyword EGL_SUPPORT_REUSE_NV. In line 8 it shows Copyright (c) 2013-2016 The Khronos Group Inc, whereas in the line 8 of https://www.khronos.org/registry/EGL/api/EGL/eglext.h it shows Copyright (c) 2013-2017 The Khronos Group Inc.

I further research and discovered that eglext.h is part of the libegl1-mesa-dev package in Ubuntu 16.04. However, there isn’t a way for me to upgrade it. How can I compile the CUDA 9.0 samples on Ubuntu 16.04?

Too add more information. My NVIDIA driver is 384.90, and my GPU is GeForce GTX TITAN X. I can also successfully execute deviceQuery

Hey Jason,

I just installed CUDA Toolkit and I exactly got the same error. However deviceQuery is not working as well. My driver is 375.66 and my GPU is GeForce GTX 960M. Sorry I am an amateur here, I do not know how to proceed as well.

Edit: deviceQuery is working and some other test programs like histogram and stuff are also working

You can’t use 375.66 with CUDA 9. Use the driver that comes with the CUDA 9 toolkit installer.

@txbob my driver is 384.90. Do you have any ideas on how to compile the samples?

@txbob - Thank you so much. My main purpose was using Caffe so I downgraded it to use with CUDA 8. That particular driver 375.66 will work with CUDA 8 right ?

Secondly, if the driver is not supposed to work with CUDA 9, why where most of sample programs running ?Just like deviceQuery ?

Thanks in advance

Replace the EGL files under /usr/include/EGL from the below link

https://www.khronos.org/registry/EGL/api/EGL/

It seems to work for me.

@fayez37 That’s bizarre. I would imagine using the up to date headers along with out of date libraries will have some issues. Is there a way to update the entire EGL all together?

Hey, a question, I have a driver 384.90, can I use CUDA 9 ? (NVIDIA Corporation GF106GL [Quadro 2000])
Other little thing, when i run the sample nbody it give me this:

CUDA error at bodysystemcuda_impl.h:281 code=13(cudaErrorInvalidSymbol) “setSofteningSquared(softeningSq)”

What could be? Thanks

Your GF106GL gpu is a Fermi cc2.x GPU that is not supported by CUDA 9. CUDA 8 is the last CUDA version that supported Fermi GPUs.

@JasonJuang I had the same error and the solution was replace the EGL files under /usr/include/EGL as @fayez37 said. if you do that nothing wrong is going to happen because this is the right way to install EGL. You can find this information on https://github.com/NVIDIA/eglexternalplatform