Package: libglewmx1.9 Version: 1.9.0-3 Severity: important Dear Maintainer,
i recently tried to add multi-context support to a project of mine that is already using GLEW. so i installed GLEWmx, added the necessary glue to my code, compiled and linked against the MX enabled version of the library. unfortunately, this gives me a lot of errors. i tried to narrow down the problem, and it seems that the binary libGLEWmx as shipped with debian, currently lacks a number of functions. if i fetch the glew-sources from upstream and build libGLEWmx myself, everything works as expected. to reproduce the problem, i created a minimal program based on glewinfo (attached). the program can be compiled either without multi-context support (glewtest), with multi-context support (glewtestMX) and - for convenience - with multi-context support but linking against a local copy of libGLEWmx. the results are: $ make glewtest > gcc glewtest.c -o glewtest -lGLEW -lGL -lX11 $ make glewtestMXlocal > gcc glewtest.c -o glewtestMXlocal -DGLEW_MX -L/tmp/zmoelnig/glew-1.9.0/lib/ > -lGLEWmx -lGL -lX11 $ make glewtestMX > gcc glewtest.c -o glewtestMX -DGLEW_MX -lGLEWmx -lGL -lX11 > /tmp/cczVClYT.o:glewtest.c:function main: error: undefined reference to > '__glewClearBufferData' > collect2: error: ld returned 1 exit status > make: *** [glewtestMX] Error 1 $ running the two successfully built binaries, i get (in both cases): > --------------------------- > GLEW Extension Info > --------------------------- > > GLEW version 1.9.0 > Reporting capabilities of display :0.0, visual 0x2f > Running on a GeForce 7800 GTX/PCIe/SSE2 from NVIDIA Corporation > OpenGL version 2.1.2 NVIDIA 304.88 is supported > glClearBufferData: MISSING since linking works ok with my local copy of libGLEWmx, i guess there is a problem with the libglewmx1.9 package. another (non-minimal) way to trigger the problem, is to try building the ordinary `glewinfo` utilitiy with MX-support: $ gcc glewinfo.c -o glewinfo -DGLEW_MX -lGLEWmx -lGL -lX11 2>&1 | grep -c error > 79 $ hope that helps. -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 3.2.0-4-686-pae (SMP w/4 CPU cores) Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libglewmx1.9 depends on: ii libc6 2.17-3 ii libgl1-mesa-glx [libgl1] 8.0.5-5 ii libx11-6 2:1.5.0-1 ii libxext6 2:1.3.1-2 ii libxi6 2:1.6.1-1 ii libxmu6 2:1.1.1-1 ii multiarch-support 2.17-3 libglewmx1.9 recommends no packages. libglewmx1.9 suggests no packages. -- no debconf information
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <GL/glew.h> #if defined(_WIN32) #include <GL/wglew.h> #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) #include <GL/glxew.h> #endif #ifdef GLEW_REGAL #include <GL/Regal.h> #endif static FILE* f; #ifdef GLEW_MX GLEWContext _glewctx; #define glewGetContext() (&_glewctx) GLXEWContext _glxewctx; #define glxewGetContext() (&_glxewctx) #endif GLboolean glewCreateContext (const char* display, int* visual); GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual); void glewDestroyContext (); static void glewInfoFunc (const char* name, GLint undefined) { unsigned int i; fprintf(f, " %s:", name); for (i=0; i<60-strlen(name); i++) fprintf(f, " "); fprintf(f, "%s\n", undefined ? "MISSING" : "OK"); fflush(f); } /* ------------------------------------------------------------------------- */ int main (int argc, char** argv) { GLuint err; char* display = NULL; int visual = -1; if (glewParseArgs(argc-1, argv+1, &display, &visual)) { fprintf(stderr, "Usage: glewinfo [-display <display>] [-visual <id>]\n"); return 1; } if (GL_TRUE == glewCreateContext(display, &visual)) { fprintf(stderr, "Error: glewCreateContext failed\n"); glewDestroyContext(); return 1; } glewExperimental = GL_TRUE; #ifdef GLEW_MX err = glewContextInit(glewGetContext()); err = err || glxewContextInit(glxewGetContext()); #else err = glewInit(); #endif if (GLEW_OK != err) { fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); glewDestroyContext(); return 1; } f = stdout; fprintf(f, "---------------------------\n"); fprintf(f, " GLEW Extension Info\n"); fprintf(f, "---------------------------\n\n"); fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION)); fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n", display == NULL ? getenv("DISPLAY") : display, visual); fprintf(f, "Running on a %s from %s\n", glGetString(GL_RENDERER), glGetString(GL_VENDOR)); fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION)); #ifdef GL_ARB_clear_buffer_object glewInfoFunc("glClearBufferData", glClearBufferData == NULL); #endif if (f != stdout) fclose(f); glewDestroyContext(); return 0; } /* ------------------------------------------------------------------------ */ GLboolean glewParseArgs (int argc, char** argv, char** display, int* visual) { int p = 0; while (p < argc) { if (!strcmp(argv[p], "-display")) { if (++p >= argc) return GL_TRUE; *display = argv[p++]; } else if (!strcmp(argv[p], "-visual")) { if (++p >= argc) return GL_TRUE; *visual = (int)strtol(argv[p++], NULL, 0); } else return GL_TRUE; } return GL_FALSE; } /* ------------------------------------------------------------------------ */ Display* dpy = NULL; XVisualInfo* vi = NULL; XVisualInfo* vis = NULL; GLXContext ctx = NULL; Window wnd = 0; Colormap cmap = 0; GLboolean glewCreateContext (const char* display, int* visual) { int attrib[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None }; int erb, evb; XSetWindowAttributes swa; /* open display */ dpy = XOpenDisplay(display); if (NULL == dpy) return GL_TRUE; /* query for glx */ if (!glXQueryExtension(dpy, &erb, &evb)) return GL_TRUE; /* choose visual */ if (*visual == -1) { vi = glXChooseVisual(dpy, DefaultScreen(dpy), attrib); if (NULL == vi) return GL_TRUE; *visual = (int)XVisualIDFromVisual(vi->visual); } else { int n_vis, i; vis = XGetVisualInfo(dpy, 0, NULL, &n_vis); for (i=0; i<n_vis; i++) { if ((int)XVisualIDFromVisual(vis[i].visual) == *visual) vi = &vis[i]; } if (vi == NULL) return GL_TRUE; } /* create context */ ctx = glXCreateContext(dpy, vi, None, True); if (NULL == ctx) return GL_TRUE; /* create window */ /*wnd = XCreateSimpleWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 1, 1, 1, 0, 0);*/ cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone); swa.border_pixel = 0; swa.colormap = cmap; wnd = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 1, 1, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap, &swa); /* make context current */ if (!glXMakeCurrent(dpy, wnd, ctx)) return GL_TRUE; return GL_FALSE; } void glewDestroyContext () { if (NULL != dpy && NULL != ctx) glXDestroyContext(dpy, ctx); if (NULL != dpy && 0 != wnd) XDestroyWindow(dpy, wnd); if (NULL != dpy && 0 != cmap) XFreeColormap(dpy, cmap); if (NULL != vis) XFree(vis); else if (NULL != vi) XFree(vi); if (NULL != dpy) XCloseDisplay(dpy); }
LOCALGLEWLIB=/tmp/zmoelnig/glew-1.9.0/lib/ glewtest: glewtest.c gcc $^ -o $@ -lGLEW -lGL -lX11 glewtestMX: glewtest.c gcc $^ -o $@ -DGLEW_MX -lGLEWmx -lGL -lX11 glewtestMXlocal: glewtest.c gcc $^ -o $@ -DGLEW_MX -L$(LOCALGLEWLIB) -lGLEWmx -lGL -lX11 clean: rm -f glewtest glewtestMX glewtestMXlocal