15
votes

I have downloaded the latest GLUI source code and now I am trying to compile it. When I do so, I get the following error:

g++ -O0 -Wall -pedantic -I./ -I./include -I/usr/X11R6/include -o bin/example1 example/example1.cpp  -L./lib -lglui -L/usr/X11R6/lib/libXdmcp.a -lglut -lGLU -lGL -lXmu -lXext -lX11 -lXi -lm
/usr/bin/ld: cannot find -lXmu
collect2: ld returned 1 exit status

When I did a locate libXmu, I get the following output:

> %:~/src/GLUI/src$ locate libXmu 
> /usr/lib/libXmu.so.6
> /usr/lib/libXmu.so.6.2.0
> /usr/lib/libXmuu.so.1
> /usr/lib/libXmuu.so.1.0.0

Do I get the error because I don't have a /usr/lib/libXmu.so? If this is the case, how can I make one? (I am not experienced with linking at all).

Thanks!

3

3 Answers

7
votes

Linux distributions usually package the libraries needed for running programs separately from the files needed to build programs.

Look for packages named *-devel or *-dev.

I don't know which one you need in particular for this, but you can use apt-cache search to look for it.

6
votes

The answer was actually one of the first ones here originally but the owner deleted it, it seems. I was able to solve the problem by creating a symbolic link to the latest version of the library (i.e. /usr/lib/libXmu.so.6) and compile the code successfully.

0
votes

I had the same problem, if creating a symbolic link doesnt help, try the following:

  1. Print your $PATH ("echo $PATH"), and check if the library file you need is in one of those directories. Use "export PATH=/newly/added/path:$PATH" to add new directory to check.
  2. Ive been including libevent, added "-levent" in the gcc command, and ld used file /usr/lib/libevent.so, so it looks like the "lib" prefix and extension are being added automatically by ld.

Keep it up.