Author Topic: Program cannot find libGLEW  (Read 3277 times)

Offline colt

  • Single posting newcomer
  • *
  • Posts: 9
Program cannot find libGLEW
« on: October 21, 2018, 01:12:31 am »
Hello. I recently build the GLEW library in a non standard dir, then proceeded to create a symbolic link for it on /usr/lib. Tried to run my program and it complained about not locating glew. Remembered to include it on the linker settings, adding the path to the glew library, which is:
Code
/media/34GB/Arquivos-de-Programas-Linux/glew-2.1.0/lib/libGLEW.so

Continued to receive the same error message. Repeated the procedure above but now poining directly to the real library and not a symbolic link to it, which is
Code
/media/34GB/Arquivos-de-Programas-Linux/glew-2.1.0/lib/libGLEW.so.2.1.0

The error message persists. It is
Code
./main: error while loading shared libraries: libGLEW.so.2.1: cannot open shared object file: No such file or directory

I already added it to a system dir that it is on the library_path, also added it to list of directories that Codeblocks is supposed to look for libraries. What else can I do?

thanks for your time.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline colt

  • Single posting newcomer
  • *
  • Posts: 9
Re: Program cannot find libGLEW
« Reply #2 on: October 21, 2018, 01:43:36 am »
Nevermind I already solved it. I forgot to add the lib dir to search directories tab.

But there is an issue  that people may help me to solve. Since I started to use external libraries, I realized through ldd, that my programs are using tons of libraries. Of course, this makes sense for these programs that use OpenGl, QT, glfw, glew, etc.. But I have a pure c/c++ program that does not use anything besides c and c++ functions and it still is using a lot of these external libraries!

Look the output of ldd on it:

Code
linux-vdso.so.1 =>  (0x00007fff631ff000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007ff8f198e000)
libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0x00007ff8f0cf8000)
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (0x00007ff8f0874000)
libglfw.so => /usr/local/lib/libglfw.so (0x00007ff8f0663000)
libGLEW.so.2.1 => /usr/lib/libGLEW.so.2.1 (0x00007ff8f03be000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007ff8f00a9000)
libm.so.6 => /lib/libm.so.6 (0x00007ff8efe26000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007ff8efc0f000)
libc.so.6 => /lib/libc.so.6 (0x00007ff8ef885000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff8f1bc8000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007ff8ef650000)
libaudio.so.2 => /usr/lib/libaudio.so.2 (0x00007ff8ef437000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007ff8ef158000)
libpng12.so.0 => /lib/libpng12.so.0 (0x00007ff8eef31000)
libz.so.1 => /lib/libz.so.1 (0x00007ff8eed1a000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007ff8eea93000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007ff8ee84b000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007ff8ee642000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007ff8ee426000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007ff8ee21c000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007ff8ee00a000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007ff8edcd3000)
libdl.so.2 => /lib/libdl.so.2 (0x00007ff8edacf000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007ff8ed8ca000)
librt.so.1 => /lib/librt.so.1 (0x00007ff8ed6c1000)
libGL.so.1 => /usr/lib/mesa/libGL.so.1 (0x00007ff8ed440000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00007ff8ed216000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x00007ff8ecfb1000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007ff8ecdad000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007ff8ecb7e000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007ff8ec979000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007ff8ec75c000)
libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x00007ff8ec556000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00007ff8ec353000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00007ff8ec14c000)
libdrm.so.2 => /lib/libdrm.so.2 (0x00007ff8ebf41000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007ff8ebd3b000

I remeber there was a time it only used 6 libraries or so. It is definitely not using most of these libraries, certainly not QT and Glew stuff that I am only using in the new little programs. What can I do to get rid of them. They may be increasing the program size without any need!

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Program cannot find libGLEW
« Reply #3 on: October 22, 2018, 07:19:23 pm »
Well, either you put these libraries into the global compiler configuration, then it gets applied to every program you compile, remove them and add them to the required projects only. Or you have put them into a project and copy-pasted the project without removing them :).

But my magic reading remote computers over the air is quite limited and people get quite creative producing very strange configurations, without further details it is impossible to say for sure what is causing these dependencies ;D.

Offline colt

  • Single posting newcomer
  • *
  • Posts: 9
Re: Program cannot find libGLEW
« Reply #4 on: October 27, 2018, 11:36:28 pm »
Well, either you put these libraries into the global compiler configuration, then it gets applied to every program you compile, remove them and add them to the required projects only.

Yes, they are in the "search directories and "linker settings" of "global compiler settings". But how can I add them on per project base?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org