Fs2 open on Linux/Missing -lGLU compile error

From FreeSpace Wiki
Jump to: navigation, search
« SDL: undefined reference to ... The fs2_open on Linux Guide
Missing -lGLU compile error
Common Runtime Errors »

On some Linux distributions (Slackware for instance), compiling fails because a GL related library doesn't have a link in the /usr/lib directory. If the compile fails because it can't find -lGLU, here are two ways to fix it:

Solution as Root

If you have root access to the system, you can create a link to the library in question with just a little bit of command line magic. Go to a console and enter:

$ ln -s /usr/X11R6/lib/libGLU.so /usr/lib/libGLU.so

After that, you can run make again and it should finish compiling.

Solution as User

You don't have root access? Never fear, we can still fix the problem. It'll just be a tad more difficult.

Navigate to the fs2_open/code directory and locate a file named Makefile (not Makefile.rm or Makefile.in or Makefile.anything). Open it in your favorite text editor and make the following changes.

Find this line (line 457 in mine):

FS2_LDFLAGS =  -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lGLU -lopenal \
  -logg -lvorbis -lvorbisfile

And replace it with this:

FS2_LDFLAGS =  -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lopenal -logg \
  -lvorbis -lvorbisfile -L/usr/X11R6/lib -lGLU 

Also find this one (line 565 in mine):

AM_LDFLAGS =  -g  -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lGLU -lopenal \ 
  -logg -lvorbis -lvorbisfile

And replace it with this:

AM_LDFLAGS =  -g -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -lGL -lopenal -logg \
  -lvorbis -lvorbisfile -L/usr/X11R6/lib -lGLU

Then run make from the fs2_open directory, and watch the magic happen.