Tuesday, January 1, 2013

[Solved] Error: Cannot find -IGL / Cannot find existing library

While I was running a OpenCV project on QT, I came up with a wired error. It was like "cannot find -IGl".  I was working on Fedora 16 x86_64 system.
Later I knew that the error was due to  Shared Object (SO) Name, also called soname,  and its versoining.

When linking, the link editor (ld) can take a library as parameter via a link-library parameter (-lGL). When it goes to look the library, it simply search the file by replacing l with lib and appending .so at the end of the link-library parameter. Now the parameter becomes libGL.so. However, it may not find exactly libGL.so and may find different versions like libGL.so.1, libGL.so.1.1 etc. This is the actual reason of my problem.  Linker is looking for libGL.so but I  only have libGL.so.1.

The quick solution of these type of problem is to symlink libGL.so.1 to libGL.so. This can be by using following Linux command

$ su
$ cd  /usr/lib64
$ ln -s ./libGL.so.1 ./libGL.so

This may solve your problem.

Note : I have given the example of libGL.so but this trick works for all existing libraries. Use the trick accordingly.

1 comment:

  1. Thanks for the post. Solved my issue I had with Qt.