centOS 7 / CUDA 8.0 Installation Problem | Incompatible libGL.so when searching for -lGL

Hi, I am new to Linux development. I am unable to test the nVidia CUDA installation

Error code:

cd /usr/local/cuda-8.0/samples/5_Simulations/nbody sudo make
$ ./nbody

Error output:

[root@localhost nbody]# sudo make
“/usr/local/cuda-8.0”/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_20,code=sm_20 -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_60,code=compute_60 -o nbody bodysystemcuda.o nbody.o render_particles.o -L/usr/lib64/nvidia -lGL -lGLU -lX11 -lglut
nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/…/…/…/libGL.so when searching for -lGL
/bin/ld: skipping incompatible /lib/libGL.so when searching for -lGL
/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [nbody] Error 1

Procedures followed:

Install latest copy of CentOS7 and use software updater to update all

Download nVidia driver | http://www.nvidia.com/Download/index.aspx
Download CUDA 8 (under legacy link) | https://developer.nvidia.com/cuda-80-ga2-download-archive
Installed driver 384.98 first and Cuda8 using run files as shown in | http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
Installed 3-rd party libs | http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#install-libraries

gcc --version > gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
ld --version > GNU ld version 2.25.1-32.base.el7_4.1

*have tried rebooting

Anyone with experience of installing CUDA 8.0 on centOS please help.

Thank you.

The proper libGL.so is probably in either:

/usr/lib64/libGL.so

/usr/lib64/nvidia/libGL.so

are either of these directories on your linker search path?

you might also want to check to see if there is actually a libGL.so in either of those directories.

If the files are there, you may either need to add the directory to your linker search path, or else add link Library directive to the makefile/compile command to find them:

-L/usr/lib64

and/or

-L/usr/lib64/nvidia