NOTE: I initially posted this to a different forum, I figured I'd copy the original post but there are some addendums at the bottom.
Recently the SM64 PC port announced back in May has gotten some additions and tweaks in the form of a fork called sm64ex, one of them being a backend that uses legacy OpenGL (1.1) instead of the original which I believe needed 2.0. I decided it would be fun to try and compile it for IRIX on my O2.
Well, I ran into a couple errors in my adventure so far, but I have been able to resolve all of them reasonably except for this one I encountered at linking time:
As far as I know, the default LDFLAGS for GL specifically in the project are just -lGL. sdl-config pulls in some libs of its own but AFAIK none of it has to do with opengl. So reading the error I figured I'd try adding GLCore. Well, this is what happens in that case:
No re-ordering of the linker flags, or specifying the DSOs manually by their full paths, has gotten rid of both of these errors. It seems like whenever glCore is present, the latter error happens, and when it isn't, the first one always appears. Googling tells me very little about the symbols in question for the second error, and I'm thinking the reason why is because those are internal symbols that GL and GLcore use to talk to each other, and not something that's exposed. Either that or, as the name of the function suggests, they're just SGI specific extensions that very few software has used and as a result there's nothing on the internet for them. I'm thinking that glCore is not meant to ever be used directly in linker flags, but I'm still not really sure what's causing the first error. Maybe my GL setup is broken on my machine? It says it can't read the symbols from GLcore, but if I specify it explicitly, it clearly understands the file and I know it isn't corrupt. That's why I wanted to ask here, since I was wondering if anybody had seen the same type of issues when trying to compile GL programs.
FYI, this uses SGUG-RSE 0.0.6, so GCC and GNU LD.
Addendum 1: Firstly, the second error looks like it's a result of the fact that libGLcore is not supposed to be invoked on the command line like this, because it's linked directly to libGL and should automatically be picked up. And after some playing around with nm and ldd a little bit, and being unable to find gl_INTERPRET_END anywhere in the GL libraries on my system, I'm thinking that GNU ld might be the problem here. I would try IRIX ld but I can't, at least not with what I currently have because the rest of the program was compiled with GCC and GCC performs LTO, meaning the object files are pretty meaningless to a non-GNU linker (afaik). And I would re-compile with MIPSpro, but I doubt it will compile without a huge struggle given the large codebase. The SM64 pc port also relies on tools that are only in SGUG like python3 so my path might get a little wonky. So I'm trying to stick with just SGUG-RSE, but it's proving hard. The reason in particular I'm leaning towards it being a GNU ld problem is that the GNU nm that comes with the same binutils refuses to read any of my system libraries, it just says that no symbols are found. Maybe one of the RSE devs knows something about this? I think it would be helpful to try and compile a simple GL demo, but I'm not a programmer or anything so I haven't been able to find anything that doesn't rely on an external dep not included in IRIX by default like GLUT. One should just be able to grab the opengl context using Xlib+GLX, Motif or even SDL since I have that installed, and that would narrow down my issue significantly.
Also, I'm thinking of trying Nekoware GCC, it should be a little less incompatible than MIPSPro despite being a little older but more stable than RSE.
Recently the SM64 PC port announced back in May has gotten some additions and tweaks in the form of a fork called sm64ex, one of them being a backend that uses legacy OpenGL (1.1) instead of the original which I believe needed 2.0. I decided it would be fun to try and compile it for IRIX on my O2.
Well, I ran into a couple errors in my adventure so far, but I have been able to resolve all of them reasonably except for this one I encountered at linking time:
Code:
/usr/sgug/bin/ld: build/us_pc/src/pc/gfx/gfx_opengl_legacy.o: undefined reference to symbol 'glColor3f'
/usr/sgug/bin/ld: note: 'glColor3f' is defined in DSO //usr/lib32/libGLcore.so so try adding it to the linker command line
//usr/lib32/libGLcore.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make: *** [Makefile:990: build/us_pc/sm64.us.f3dex2e] Error 1
Code:
/usr/lib32/../lib32/libGL.so: undefined reference to `XSGIMiscQueryExtension'
/usr/lib32/../lib32/libGL.so: undefined reference to `_XSGISetSpecialDestroyHandler'
/usr/lib32/../lib32/libGL.so: undefined reference to `_XSGISetSpecialDestroyInterest'
/usr/lib32/libGLcore.so: undefined reference to `gl_INTERPRET_END'
collect2: error: ld returned 1 exit status
make: *** [Makefile:990: build/us_pc/sm64.us.f3dex2e] Error 1
FYI, this uses SGUG-RSE 0.0.6, so GCC and GNU LD.
Addendum 1: Firstly, the second error looks like it's a result of the fact that libGLcore is not supposed to be invoked on the command line like this, because it's linked directly to libGL and should automatically be picked up. And after some playing around with nm and ldd a little bit, and being unable to find gl_INTERPRET_END anywhere in the GL libraries on my system, I'm thinking that GNU ld might be the problem here. I would try IRIX ld but I can't, at least not with what I currently have because the rest of the program was compiled with GCC and GCC performs LTO, meaning the object files are pretty meaningless to a non-GNU linker (afaik). And I would re-compile with MIPSpro, but I doubt it will compile without a huge struggle given the large codebase. The SM64 pc port also relies on tools that are only in SGUG like python3 so my path might get a little wonky. So I'm trying to stick with just SGUG-RSE, but it's proving hard. The reason in particular I'm leaning towards it being a GNU ld problem is that the GNU nm that comes with the same binutils refuses to read any of my system libraries, it just says that no symbols are found. Maybe one of the RSE devs knows something about this? I think it would be helpful to try and compile a simple GL demo, but I'm not a programmer or anything so I haven't been able to find anything that doesn't rely on an external dep not included in IRIX by default like GLUT. One should just be able to grab the opengl context using Xlib+GLX, Motif or even SDL since I have that installed, and that would narrow down my issue significantly.
Also, I'm thinking of trying Nekoware GCC, it should be a little less incompatible than MIPSPro despite being a little older but more stable than RSE.