Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: ld: cannot find -lGL (centos 7)

  1. #1
    Newbie Newbie
    Join Date
    Jul 2016
    Posts
    4

    ld: cannot find -lGL (centos 7)

    when I try to sudo make (or just make)
    for the glew-1.13.0 tarball which I extracted
    I get a link error /bin/ld: cannot find -lGL

    -L/usr/lib64 is in the cc command

    I used yum to install mesa-libGL-devel and mesa-libGLU-devel,
    and if I run it again it says both are "already installed and latest version".
    I am able to run /usr/bin/glxinfo and glxinfo64
    and if I do ldd /usr/bin/glxinfo it shows
    libGL.so.1

    And indeed in /usr/lib64 I see the symlinks libGL.so and libGL.so.1 and the real file libGL.so.355.11 (and also libGL.la)

    Any ideas what's going on? Thanks, Colin
    Last edited by colinrein; 07-15-2016 at 12:58 AM. Reason: typo

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,467
    Quote Originally Posted by colinrein View Post
    And indeed in /usr/lib64 I see the symlinks libGL.so and libGL.so.1 and the real file libGL.so.355.11
    I'm fairly sure that libGL.so.355.11 is the nVidia version, not the Mesa version.

    What does
    Code :
    ls -l /usr/lib64/libGL.so
    ldd /usr/lib64/libGL.so
    show?

    Other than that, I'd suggest checking the CentOS (or RHEL) documentation regarding installing OpenGL. This kind of issue tends to be quite specific to a particular distribution and version.

  3. #3
    Newbie Newbie
    Join Date
    Jul 2016
    Posts
    4
    these return:
    Code :
    $ ls -l /usr/lib64/libGL.so
    lrwxrwxrwx. 1 root root 14 Jul 14 16:34 /usr/lib64/libGL.so -> libGL.so.1.2.0                                            
    $ ldd /usr/lib64/libGL.so
    ldd: /usr/lib64/libGL.so: No such file or directory
    $ ldd /usr/lib64/libGL.so.1.2.0
    ldd: /usr/lib64/libGL.so.1.2.0: No such file or directory
    Does that clarify anything?

    If the linker is referring to the symbolic link file libGL.so (via -lGL compiler flag) does it care which version of the real library is present? I would assume the latest nvidia version for my specific GPU ought to be desirable...?
    Thanks.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,467
    Quote Originally Posted by colinrein View Post
    Does that clarify anything?
    Yes. libGL.so is a dangling symlink (i.e. it references a file which doesn't exist).

    Quote Originally Posted by colinrein View Post
    If the linker is referring to the symbolic link file libGL.so (via -lGL compiler flag) does it care which version of the real library is present? I would assume the latest nvidia version for my specific GPU ought to be desirable...?
    The linker uses the libGL.so symlink to open the library. This doesn't exist, which is the root of your problem.

    The fact that you have an actual library doesn't matter if the libGL.so symlink doesn't refer to it.

    If you're using the proprietary nVidia driver, you should probably remove mesa and mesa-devel and install the nVidia package and its associated -devel package.

    The resulting executable ought to work with either, but the -devel package must match the run-time library.

  5. #5
    Newbie Newbie
    Join Date
    Jul 2016
    Posts
    4
    Quote Originally Posted by GClements View Post
    Yes. libGL.so is a dangling symlink (i.e. it references a file which doesn't exist).
    The linker uses the libGL.so symlink to open the library. This doesn't exist, which is the root of your problem.
    Would it work to just update the symlink to point to the nvidia version libGL.so.355.11 ?

    Also, shouldn't the correct library versions for the mesa packages have been installed when I used yum to install those?

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,467
    Quote Originally Posted by colinrein View Post
    Would it work to just update the symlink to point to the nvidia version libGL.so.355.11 ?
    Probably. But it ought to be possible to get this working using the package manager, and that should be preferred. So you should first try uninstalling all related packages then reinstalling only the correct ones. And read any applicable documentation first. There may be other factors beside the symlink.

    Quote Originally Posted by colinrein View Post
    Also, shouldn't the correct library versions for the mesa packages have been installed when I used yum to install those?
    I would have thought that it would have refused to install both -devel packages at the same time, and possibly refused to install both runtime packages.

  7. #7
    Newbie Newbie
    Join Date
    Jul 2016
    Posts
    4
    Well this Nvidia devtalk post fixed my error: the libGL.so symlink was dangling (as you said GClements),
    so I deleted and recreated symlink libGL.so pointing to libGL.so.1 which points to libGL.so.355.11
    not sure what broke it.

    https://devtalk.nvidia.com/default/t...1-exit-status/

    thanks for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •