Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

libSDL.so: undefined reference to `_XGetRequest' #228

Closed
jtpalmer opened this Issue · 3 comments

2 participants

@FROGGS
Owner

We should apply this patch:
http://lists.libsdl.org/pipermail/commits-libsdl.org/2012-January/005293.html

details:   http://hg.libsdl.org/SDL/rev/e1264a758d50
changeset: 6225:e1264a758d50
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Wed Jan 18 03:03:23 2012 -0500
description:
Add dynamic symbol for _XGetRequest, which libX11 1.4.99.1 added.

Fixes Bugzilla #1376.

diffstat:

 src/video/x11/SDL_x11dyn.c |  24 ++++++++++++++++++++++++
 src/video/x11/SDL_x11sym.h |   6 ++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diffs (57 lines):

diff -r 6f013dd0add1 -r e1264a758d50 src/video/x11/SDL_x11dyn.c
--- a/src/video/x11/SDL_x11dyn.c    Mon Jan 16 14:27:47 2012 -0500
+++ b/src/video/x11/SDL_x11dyn.c    Wed Jan 18 03:03:23 2012 -0500
@@ -112,6 +112,21 @@
 #undef SDL_X11_SYM


+static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len)
+{
+   xReq *req;
+   WORD64ALIGN
+   if (dpy->bufptr + len > dpy->bufmax)
+       _XFlush(dpy);
+   dpy->last_req = dpy->bufptr;
+   req = (xReq*)dpy->bufptr;
+   req->reqType = type;
+   req->length = len / 4;
+   dpy->bufptr += len;
+   dpy->request++;
+   return req;
+}
+
 static int x11_load_refcount = 0;

 void SDL_X11_UnloadSymbols(void)
@@ -174,6 +189,15 @@
                                                         &SDL_X11_HAVE_UTF8);
        #endif

+       /*
+        * In case we're built with newer Xlib headers, we need to make sure
+        *  that _XGetRequest() is available, even on older systems.
+        *  Otherwise, various Xlib macros we use will call a NULL pointer.
+        */
+       if (!SDL_X11_HAVE_XGETREQUEST) {
+           p_XGetRequest = SDL_XGetRequest_workaround;
+       }
+
        if (SDL_X11_HAVE_BASEXLIB) {  /* all required symbols loaded. */
            SDL_ClearError();
        } else {
diff -r 6f013dd0add1 -r e1264a758d50 src/video/x11/SDL_x11sym.h
--- a/src/video/x11/SDL_x11sym.h    Mon Jan 16 14:27:47 2012 -0500
+++ b/src/video/x11/SDL_x11sym.h    Wed Jan 18 03:03:23 2012 -0500
@@ -170,6 +170,12 @@
 #endif

 /*
+ * libX11 1.4.99.1 added _XGetRequest, and macros use it behind the scenes.
+ */
+SDL_X11_MODULE(XGETREQUEST)
+SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),return)
+
+/*
  * These only show up on some variants of Unix.
  */
 #if defined(__osf__)
@FROGGS FROGGS was assigned
@jtpalmer
Owner

Fixed in 1.432

@jtpalmer jtpalmer closed this
@zenna zenna referenced this issue in mgbellemare/Arcade-Learning-Environment
Closed

LibSDL symbol lookup errors #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.