IRIX Network Forums
OpenGL Performer linking issues [SOLVED] - Printable Version

+- IRIX Network Forums (//forums.irixnet.org)
+-- Forum: SGI/MIPS (//forums.irixnet.org/forum-3.html)
+--- Forum: Development/Porting (//forums.irixnet.org/forum-9.html)
+--- Thread: OpenGL Performer linking issues [SOLVED] (/thread-3763.html)



OpenGL Performer linking issues [SOLVED] - lenix - 12-04-2022

Hello,
For the past couple days, I've been banging my head against a wall trying to figure out why I can't get any OpenGL Performer code to link with ld, and I'm hoping you guys can help. 

I've got IRIX 6.5.22 and Performer 2.2 on my O2. Just trying the sample code (hello.c to be exact), it compiles with cc, but ld doesn't want to link it. Even after telling it to link libpf.so (and the related libraries) it gives me a bunch of unresolved symbol errors on the basic Performer functions like pfInit and pfExit. Here's my whole linker command (I'm using the same library arguments for cc):

Code:
ld -o hello -v lpfdu_ogl -lpfui -lpfutil_ogl -lpf_ogl -limage -lGLU -lGL
-lXext -lXmu -lX11 -lm -lfpe -lmalloc -lC hello.o

Another thing is that with the library I'm assuming a lot of these symbols come from (libpf.so), ld says that it isn't being used to resolve any symbols, and yet it's needed to resolve the symbols it's yelling about, which is odd to me.

I have a feeling my installation needs to get redone, but I'd like a second opinion before I blow it all away Smile

I will provide exact command outputs when I'm free today

Thanks!


RE: OpenGL Performer linking issues - jpstewart - 12-05-2022

IRIX ld is very picky about the order in which libraries are listed.  It scans them in the order they are named on the command line and uses them to resolve any unresolved symbols from prior objects.  It doesn't carry them forward, so to speak, to subsequent objects.  (Unlike, say, GNU ld which doesn't care about order at all.)

So, to me, the glaring mistake is that your hello.o object is listed last.  None of the libraries in your command will be used to resolve symbols in hello.o.  But hello.o will be used to resolve symbols in them (of which there should be none).  So that's backwards.  Put hello.o before all the libraries so that they can be used to satisfy the symbols in hello.o.


RE: OpenGL Performer linking issues - Raion - 12-05-2022

Yeah, thankfully most software isn't moronic about link order. It's a good practice to use link flags last.


RE: OpenGL Performer linking issues [SOLVED] - lenix - 12-05-2022

(12-05-2022, 01:54 AM)jpstewart Wrote:  IRIX ld is very picky about the order in which libraries are listed.  It scans them in the order they are named on the command line and uses them to resolve any unresolved symbols from prior objects.  It doesn't carry them forward, so to speak, to subsequent objects.  (Unlike, say, GNU ld which doesn't care about order at all.)

So, to me, the glaring mistake is that your hello.o object is listed last.  None of the libraries in your command will be used to resolve symbols in hello.o.  But hello.o will be used to resolve symbols in them (of which there should be none).  So that's backwards.  Put hello.o before all the libraries so that they can be used to satisfy the symbols in hello.o.

Yep, that was the issue. So annoying, but now I can get to real OpenGL programming. Also, definitely putting library flags at the end from now on no matter what machine I program on :)

Thanks to both of you!