OpenGL Linker Error (OSX) and Possible Solution

For all the help you need with Armagetron!
Post Reply
Tim-Misny
Posts: 9
Joined: Sun Aug 02, 2015 6:01 pm

OpenGL Linker Error (OSX) and Possible Solution

Post by Tim-Misny »

This is more of a bug report than a question, but I wasn't sure where to put it so I decided here was a good enough spot.

I'm currently trying to compile armagetron on OSX 10.11.
I was compiling the stable branch of 0.2.8 from LaunchPad when I came across across a linker error that looked like this:

Code: Select all

> sudo make -j6 install

Making install in src
Making install in first

...blahblah...

g++   -I../../src/tools  -I../../src/render -I../../src/ui     -I../../src/network -I../../src/engine  -I../../src/thirdparty/particles -I../../src/tron  -O2 -Wno-long-long    -o armagetronad_main tron/armagetronad_main-gFloor.o libtron.a libenginecore.a libengine.a libnetwork.a libui.a librender.a libtools.a -lSDL_image -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib -lxml2 -lz -lpthread -licucore -lm   -lpng16

Undefined symbols for architecture x86_64:
  "_glAlphaFunc", referenced from:
      sr_ResetRenderState(bool) in librender.a(librender_a-rScreen.o)
  "_glBegin", referenced from:
      glRenderer::BeginLines() in librender.a(librender_a-rGLRender.o)
      glRenderer::BeginTriangles() in librender.a(librender_a-rGLRender.o)
      glRenderer::BeginQuads() in librender.a(librender_a-rGLRender.o)
      glRenderer::BeginLineStrip() in librender.a(librender_a-rGLRender.o)
      glRenderer::BeginTriangleStrip() in librender.a(librender_a-rGLRender.o)
      glRenderer::BeginQuadStrip() in librender.a(librender_a-rGLRender.o)
      glRenderer::BeginTriangleFan() in librender.a(librender_a-rGLRender.o)
"_glBindTexture", referenced from:

...blah blah blah a lot more traceback errors in a similar format...

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [armagetronad_main] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1
It seems as though the OpenGL library isn't being linked properly on this call.
This confused me a bit but I was essentially able to quickly patch over this simply by changing a line in the Makefile located in 0.2.8/build/src from:

Code: Select all

armagetronad_main_LDADD = libtron.a libenginecore.a libengine.a libnetwork.a libui.a librender.a libtools.a
to

Code: Select all

armagetronad_main_LDADD = libtron.a libenginecore.a libengine.a libnetwork.a libui.a librender.a libtools.a -framework OpenGL
Which simply appends that framework call onto the specific g++ call that caused the linker error.

However I will say that this post is still a question somewhat. After I added this fix everything compiled perfectly (though not into an app bundle as I expected from make install). When I tried to execute the binary, the app crashes almost immediately. Since I don't know enough about the whole compilation process I can't rule out that the two errors are related. Thus I will link to a separate post explaining the crashing issue momentarily.

Update: link to post-compilation crash issue here: http://forums3.armagetronad.net/viewtop ... 49&t=24632
User avatar
Z-Man
God & Project Admin
Posts: 11582
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: OpenGL Linker Error (OSX) and Possible Solution

Post by Z-Man »

Like Lucifer says on the other thread, the 0.2.8 branch definitely is intended to be compiled with XCode on Mac. While it should technically be possible to also support plain make builds, we don't. Sorry.
Post Reply