Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: SuperBible 6th ed: Cannot link the Linux examples

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    3

    Question SuperBible 6th ed: Cannot link the Linux examples

    Has anyone had any luck getting the SuperBible 6th ed Linux examples to link? According to HOWTOBUILD.TXT included in the examples, you just need to execute:
    Code :
    cmake .
    make
    The sample code compiles, but it appears that the makefiles generated by cmake don't have the correct linker options as I get a bunch of undefined references to GLFW (yes, I successfully built and installed GLFW) and dl functions (dlopen, dlclose, dlsym).

    I have tried building the examples from the source provided on the SuperBible site as well as the SuperBible github.

  2. #2
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    19
    I have found that SB creates and uses their own libraries. GLTools.h is one of those libraries. These tools are specifically designed to run on MSVS express 2008. To get the library defined (I am just figuring this our right now), I think you have to do this:



    1 Go to freeglut's site and download the latest version (currently 2.6.0)

    2. Create a c:/libs directory, and unpack the freeglut package there. You should end up with a directory called c:/libs/freeglut-2.6.0.

    3.Run MSYS (c:/MinGW/msys/1.0/msys.bat). You should be in your home directory (denoted by ~ after your user and host in the top line).

    4.Type "cd /c/libs/freeglut-2.6.0/src" and press [enter]. The ~ will change to /c/libs/freeglut-2.6.0/src to denote your current working directory.

    5.Type "gcc -O2 -c -DFREEGLUT_STATIC *.c -I../include" and press [enter]. What we are doing here is calling the gcc compiler, instructing it to use O2 optimization, set the flag FREEGLUT_STATIC, and compile every source file in this directory into .o object files, and to look for headers in "../include". That means to go down one level (to /c/libs/freeglut-2.6.0) and look for the /include directory there.

    6.Type "ar rcs libfreeglut32_static.a *.o" and press enter. To the best of my understanding, ar is the utility that compiles static libraries, archive files (.a). We're telling it to create "libfreeglut32_static.a" from every object file (.o) we just compiled in the previous step.

    7.Create a /lib directory in /c/libs/freeglut-2.6.0. Then cut the library we just created and paste it in this directory. The final location of the freeglut library should be "c:/libs/freeglut-2.6.0/lib/libfreeglut32_static.a".

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    19
    I am working with SB5 right now, I would think they are doing the same thing in 6

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    19
    I am about to quit using the SB series because of this. There are 5 books that are published every time a new addition of opengl comes out the red book, orange book, green book, blue book and alpha book. I am sticking to these.

  5. #5
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    3
    Thanks for an in-depth explanation, Amad3u5. However, I believe this is a different situation as I am strictly building and running on Linux. I mentioned it in the title, but I should have explicitly mentioned it in the actual post as well. My apologies.

  6. #6
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    3
    Figured it out!

    In CMakeLists.txt, there is a section that looks like this:
    Code :
    if(WIN32)
    set(COMMON_LIBS sb6 optimized GLFW_r32 debug GLFW_d32)
    elif (UNIX)
    set(COMMON_LIBS sb6 glfw ${GLFW_LIBRARIES} GL rt dl)
    else()
    set(COMMON_LIBS sb6)
    endif()

    I had to change it to this:
    Code :
    if(WIN32)
    set(COMMON_LIBS sb6 optimized GLFW_r32 debug GLFW_d32)
    else()
    set(COMMON_LIBS sb6 glfw ${GLFW_LIBRARIES} GL rt dl)
    endif()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •