cannot find -lGL

When I try to compile CUDA 6.0 RC OpenGL samples on Fedora 20 I get the following error:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../.
./../libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /lib/libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [simpleGL] Error 1

Any idea how to solve it?

OK, got it fixed. It was just a broken symbolic link.

0 lrwxrwxrwx. 1 root root      14 Mar 12 11:03 /usr/lib64/libGL.so -> libGL.so.1.2.0
   0 lrwxrwxrwx. 1 root root      15 Mar 12 02:47 /usr/lib64/libGL.so.1 -> libGL.so.334.21
1156 -rwxr-xr-x. 1 root root 1180136 Mar 12 02:47 /usr/lib64/libGL.so.334.21

libGL.so was broken, so ln -sfn libGL.so.1 libGL.so did the trick. It’s working now.

0 lrwxrwxrwx. 1 root root      21 Mar 13 01:01 /usr/lib64/libGL.so -> /usr/lib64/libGL.so.1
   0 lrwxrwxrwx. 1 root root      15 Mar 12 02:47 /usr/lib64/libGL.so.1 -> libGL.so.334.21
1156 -rwxr-xr-x. 1 root root 1180136 Mar 12 02:47 /usr/lib64/libGL.so.334.21

There is an IBM support doc describing the issue: libGL symbolic link may be broken during NVIDIA CUDA install - IBM System Cluster 1350 (1410)

I am a gaming developer for linux, Have same problem using a nvidia gforce 1060 gt on ubuntu 18.04 lts using official drivers.

Similar solution: http://techtidings.blogspot.com/2012/01/problem-with-libglso-on-64-bit-ubuntu.html

I repared broken links, but when ubuntu upgrade the system this break symbolic links again.