Ondřej Plátek Archive
PhD student@UFAL, Prague. LLM & TTS evaluation. Engineer. Researcher. Father.

Building OpenGL Tutorial

Building OpenGL tutorials from great book Learning Modern 3D Graphics Programming Jason L. McKesson was pain, but no blame goes on authors head.
Bitbucket repo of the book

I follow steps of tutorial at Tutorial. I was supposed to be using premake4 so I typed

sudo apt-get install premake4

Now it comes, I had installed software called premake4, which is still version 3.7 (really stupid naming convention).
After that I got the error below and the tutorial did not build.

** premake4.lua: ../framework/framework.lua:8: attempt to call global 'solution' (a nil value)


Solution is very simple. To download premake 4.3 from SourceForge

Remarks on other building steps

  • Use Premake and building utility of your choice to build libraries shipped with project too!
    It means run it in directories tinyxml, glsdk

  • I got error

    freeglut (./Tut 01 MainD): glXCreateContextAttribsARB not found

    The reason is that this tutorial is teaching Opengl 3.0 so I need to grab some real hardware not my crappy notebook.
    Seriously, It means that my graphic card does not support OpenGL 3.0:( I have to move to school tu run it.

Second build on different computer, path problems

With premake4 correctly set up I hoped for better experience.
Nevertheless, I end up at looking following error.

/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../../i686-pc-linux-gnu/bin/ld: ../glsdk/freeglut/lib/libfreeglutD.a(freeglut_main.o): undefined reference to symbol 'XPending'
/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../../i686-pc-linux-gnu/bin/ld: note: 'XPending' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
/usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

Simple solution is to add


to correct makefile. I finally found that correct makefile is

Tut 02 Fragment Position.make

for Tutorial 2.

Unfortunately, I did not find out quickly how to add X11 to path quickly.
I tried setting several variables but without effect.
Mention the one I remember: