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 7 of 7

Thread: gl3w- undefined reference to 'glXGetProcAddress'

  1. #1
    Intern Contributor
    Join Date
    Dec 2010
    Posts
    57

    gl3w- undefined reference to 'glXGetProcAddress'

    Trying to convert a project onto Linux that uses gl3w.

    I have #include "GL3/gl3.h" and #include "GL3/gl3w.h"

    I link to "-lgl3w" but I get this error on linking:

    Code :
    libgl3w.so: undefined reference to 'glXGetProcAddress'

    Are there more files or libraries I need to include?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948

    Re: gl3w- undefined reference to 'glXGetProcAddress'

    Are you including X11 and OpenGL? Because glXGetProcAddress is not part of GL3W.

  3. #3
    Intern Contributor
    Join Date
    Dec 2010
    Posts
    57

    Re: gl3w- undefined reference to 'glXGetProcAddress'

    Okay so now I added -lGL to the linker and I no longer get the error.

    So far the only problem I notice is that I am getting a 2.1 context instead of a 3.x or 4.x...

    Edit:
    Hmm noticing that gl3wInit() returns -1...some sort of problem there.

    Edit2:
    gl3w only gave me the libgl3w.so file and gl3w.h, gl3w.c, and gl3.h...am I still missing some kind of opengl library file? I just added -lGL to the linker...but is that not the right library?>>

    Edit3:
    I noticed this is the output of my glGetString GL_VENDOR, GL_VERSION, etc. shows onboard graphics, not the discrete Nvidia card:
    Code :
    Tungsten Graphics, Inc
    Mesa DRI Intel(R) Sandybridge Mobile 
    2.1 Mesa 7.11

  4. #4
    Intern Contributor
    Join Date
    Dec 2010
    Posts
    57

    Re: gl3w- undefined reference to 'glXGetProcAddress'

    Update:

    So I found I had to disable integrated graphics in the BIOS in order to get the proper GL Context with the discrete graphics hardware.

    But, when I have added back in 'gl3wInit()' (it was not there before), the 'glXGetProcAddress' error returns.

    I have linked the following
    Code :
    -lSDL2 -lGL -lGLU -lgl3w -lX11
    but to no good... I tried to link to -lGLX, but it is not found as a library.

    When I search repositories I can see I have 1 GLX runtime installed...
    Code :
    $ aptitude search GLX
    i   libgl1-mesa-glx                                - free implementation of the OpenGL API -- GLX runtime     
    p   libgl1-mesa-glx-dbg                            - Debugging symbols for the Mesa GLX runtime               
    p   libswt-glx-gtk-3-jni                           - Standard Widget Toolkit for GTK+ GLX JNI library         
    p   libva-glx1                                     - Video Acceleration (VA) API for Linux -- GLX runtime     
    p   libxcb-glx0                                    - X C Binding, glx extension                               
    p   libxcb-glx0-dbg                                - X C Binding, glx extension, debugging symbols            
    p   libxcb-glx0-dev                                - X C Binding, glx extension, development files            
    p   rss-glx                                        - Really Slick Screensavers GLX Port
    Must I install another?

    How do I link to the GLX library so to fix the error that 'glXGetProcAddress()' is not found??

  5. #5
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,580

    Re: gl3w- undefined reference to 'glXGetProcAddress'

    According to this : http://dri.freedesktop.org/wiki/glXG...verReturnsNULL

    glXGetProcAddress does not have to be exported, but glXGetProcAddressARB must be.

  6. #6
    Intern Contributor
    Join Date
    Dec 2010
    Posts
    57

    Re: gl3w- undefined reference to 'glXGetProcAddress'

    How can I change the gl3w to use ARB instead of regular??

    When I do 'scons' in the gl3w directory, it generates the gl3w.c file at the same time as libgl3w.so. So if I change gl3w.c at this point, libgl3w.so is already built. I try to rebuild, but it re-builds the gl3w.c, un-doing my change.

    See the error is in libgl3w.so:
    Code :
    g++ -o debug/runme_d debug/base.o debug/bitmask.o debug/context.o debug/entity.o debug/history.o debug/intro.o debug/main.o debug/program.o debug/rangeset.o debug/renderer.o debug/storage.o debug/subsystem.o debug/timer.o debug/title.o -lSDL2 -lGL -lgl3w
    /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libgl3w.so: undefined reference to `glXGetProcAddress'

    Is that the wrong libgl3w.so? The one I built is in a different directory (/usr/lib):
    Code :
    $ ls /usr/lib | grep libgl3w
    libgl3w.so

    But, I suspect it still has the same problem since I cannot change it to use the ARB function.

  7. #7
    Intern Contributor
    Join Date
    Dec 2010
    Posts
    57

    Re: gl3w- undefined reference to 'glXGetProcAddress'

    Quote Originally Posted by PrestoChung
    See the error is in libgl3w.so:
    Code :
    g++ -o debug/runme_d debug/base.o debug/bitmask.o debug/context.o debug/entity.o debug/history.o debug/intro.o debug/main.o debug/program.o debug/rangeset.o debug/renderer.o debug/storage.o debug/subsystem.o debug/timer.o debug/title.o -lSDL2 -lGL -lgl3w
    /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libgl3w.so: undefined reference to `glXGetProcAddress'

    Is that the wrong libgl3w.so? The one I built is in a different directory (/usr/lib):
    Code :
    $ ls /usr/lib | grep libgl3w
    libgl3w.so

    But, I suspect it still has the same problem since I cannot change it to use the ARB function.
    Ok. So i found that the gl3w.c file is generated from the python script that came with gl3w repo, so I was able to edit that line in the script and change it to glXGetProcAddressARB, rebuild the library and copy it into the include and lib folders.

    I also found the glx library in some sub-folders of my /usr/lib directory

    However, even when I link to glx successfully, I still get the same undefined reference, to the ARB function and regular function:
    Code :
    g++ -o debug/runme_d debug/base.o debug/bitmask.o debug/context.o debug/entity.o debug/history.o debug/intro.o debug/main.o debug/program.o debug/rangeset.o debug/renderer.o debug/storage.o debug/subsystem.o debug/timer.o debug/title.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/xorg/modules/extensions -lSDL2 -lGL -lGLU -lglx -lxcb-glx -lgl3w -lX11
    /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../lib/libgl3w.so: undefined reference to `glXGetProcAddressARB'
    collect2: ld returned 1 exit status

    I probably don't need to link to all of those libraries...but still the error!

Posting Permissions

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