Compiling GLUT progs on SGI

Why compiling GLUT progs on my SGI is so awkward?
In my system, if I follow the examples, I have to include “glutdefs”
in my Makefile, and also a file compilers.commondefs…
Why I can’t use my own Makefile with -L and -l switches to
include the necessary libs?
I am running IRIX 6.5.10.

I am sorry to say that I don’t think I can help but I was wondering what examples you were trying to build.

I was tring to compile several of the GLUT examples includded in my IRIX 6.5.10 Onyx2. The Makefile begins with:

#-----------------------
TOP = …/…/…
include $(TOP)/glutdefs
include $(ROOT)/usr/include/make/commondefs

TARGETS = (target list here… such as atlantis…chess… geoface… etc.)

LLDLIBS = $(GLUT) -lGLU -lGL -lXmu -lXext -lX11 -lm

(rest of the make file here)
#-----------------------

I tried to compile without including the two files above and the linker will complain
of not finding a lot of glX functions. I replaced the $(GLUT) with -lglut.

I don’t think I have glut (the glut examples you are trying to use came with the distrubution?) installed on my SGI but there are probably lots of other glut examples for SGI that you could take a look at. For example, some (all?) of Mr. Molofee’s tutorials were ported to glut/SGI: http://nehe.gamedev.net/opengl.asp
The makefile for the examples I looked at were pretty straight forward.

You also might want to use the find command to make sure the paths to the glutdefs and commondefs files are correct. The definition of “TOP” looks suspicious…
Of course, you may not need commondefs at all. You could check the man pages but it looks to me like the compiler would already know where that file is!

Hello,

well, i’ve compiled GLUT stuff on an Onyx, before, so my 2c are:

if its missing glx stuff (which yuo say it is=) then you need to include libglx!! (smacls of the obvious, no?=). add -lglx to your library string, and all shuold be well.

cheers,
John

libglx? Well, it may sound strange to you but libglx is nowhere to be found on my system (that’s one of the first things I looked for). On the other hand, including
those “commondefs” and the “glutdefs” will cause the linker errors to go away… go figure! I will check out the Makefiles they pointed me to above. I will keep you posted.
-> It is frustrating to have OpenGL or GLUT problems on an SGI … of all systems!

???
<looks generally perplexed>

our sgis are down, atm and i can’t get into them <fumes and sulks>, but… i’ve had nothing but proverbial joy with opengl and glut on irix =)

<thinks deeply>

aha, i lie. i don’t have libglx on sgi. here’s one of my makefiles for a very simple program:

#!smake
include $(ROOT)/usr/include/make/commondefs

CC = cc
COMPILE_OPTIONS =
LIBS = -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm -lXt -lXext

CFLAGS = -n32 -MDupdate Makedepend -fullwarn

for the OpenGL libraries (SGI running IRIX)

LIBPATH = -L/users/cs/john/lib/GL/sgi
INCPATH = -I/users/cs/john/include

TARGET = syn
CFILES = main.c

$(TARGET): default

default:
@ if test ! -d .objs; then mkdir -p .objs; fi
@ cd .objs; $(MAKE) -f …/Makefile SYNTH
@ rm -rf $(TARGET); ln -s .objs/SYNTH $(TARGET)

include $(COMMONRULES)

SYNTH: $(OBJECTS)
$(CC) -o $@ $(OBJECTS) $(CFLAGS) $(LIBPATH) $(LIBS)

$(OBJECTS): …/$$(@:.o=.c)
$(CC) -c $(CFLAGS) $(INCPATH) …/$(@:.o=.c)

Originally posted by JoeB:
libglx? Well, it may sound strange to you but libglx is nowhere to be found on my system (that’s one of the first things I looked for). On the other hand, including
those “commondefs” and the “glutdefs” will cause the linker errors to go away… go figure! I will check out the Makefiles they pointed me to above. I will keep you posted.
-> It is frustrating to have OpenGL or GLUT problems on an SGI … of all systems!

What is inside of glutdefs? I believe that is where you will find the answer to why you need to include it to get the code to link. I may be wrong (not an expert on the SGI build process) but it looks to me like those def files (commondefs for example) provide the paths that tell the compiler where to find the -l specified libraries (along with alot of other stuff). Commondefs contains a bunch of -L paths, all the common /usr/lib* paths. So lets say you need the glx library, presumably glutdefs defines where that is. Do you need glutdefs include in the makefile? No, I just don’t believe it. If the problem is only that the linker can’t find the libraries it needs you just need to either define the path to those libraries with -L (as you stated in your first post) or put the libraries in a common place (define, presumably, by commondefs). Also, I am sure there is some way to get the compiler to read glutdefs automatically so you do not need to include it in your makefile.
Anyhow, the issue you are having is not with openGL or glut it is with the Makefile or the way the examples were installed. Blame the guys who wrote the examples. By the way, where did you get them? If they were installed from an SGI distribution I would not be surprised if you did not have everything you needed. I have never been able to figure out how SGI packages there stuff. I have spent many an hour on the phone with SGI support trying to track down various bits and pieces of some distribution which was scattered over several CD’s.
If you don’t mind, when you figure it all out can you post a reply with the info? I have not start to use OGL on the SGI yet but I would like to start soon. (I think I will start with the NeHe examples and download and install glut myself)