Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libX11-1.4.99.1 adds _XGetRequest symbol which SDL must define too #656

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 1.2
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2012-01-17 05:58:18 +0000, Petr Pisar wrote:

Created attachment 779
Fix

libX11-1.4.99.1 added new function_XGetRequest() http://lists.x.org/archives/xorg-announce/2011-November/001756.html. This function is declared as

extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);

thus it must be resolved by linker at run-time. This is not true with current SDL-1.2 code:

$ ldd -r -d /usr/lib64/libSDL.so
linux-vdso.so.1 => (0x00007fff2cf81000)
libm.so.6 => /lib64/libm.so.6 (0x00007fa7f1bf1000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fa7f19ed000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa7f17d0000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa7f141d000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa7f2199000)
undefined symbol: _XGetRequest (/usr/lib64/libSDL.so)

On 2012-01-17 06:06:50 +0000, Sam Lantinga wrote:

Gah, Ryan, how did we handle optional X11 symbol resolution again?

On 2012-01-17 17:43:36 +0000, Ryan C. Gordon wrote:

(In reply to comment # 1)

Gah, Ryan, how did we handle optional X11 symbol resolution again?

Doh, let me look into this.

--ryan.

On 2012-01-18 00:04:38 +0000, Ryan C. Gordon wrote:

Created attachment 780
Better fix.

Attachment # 779 forgot the "return" keyword on the macro, and would fail if used on an older Xlib that lacks this symbol because it's listed as part of base X11.

This patch should load the symbol, and deal with old systems without the symbol when building SDL with the newer headers.

It was really irresponsible of the Xlib developers to break binary compatibility like this.

--ryan.

On 2012-01-18 05:25:50 +0000, Petr Pisar wrote:

Let me ask:

(1) Does the return keyword mean SDL returns immediately instead of calling the function from libX11? If do, then why _XFlushGCCache is missing the keyword:

SDL_X11_SYM(void,_XFlushGCCache,(Display* a,GC b),(a,b),)

I did not find the `_XFlushGCCache' anywhere else in the SDL code, thus I think it's not used by SDL.

(2) Also you check for SDL_X11_HAVE_XGETREQUEST, but

#define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
SDL_X11_SYM(void ,_XGetRequest,(Display a,CARD8 b,size_t c),(a,b,c),return)

should create SDL_X11_HAVE__XGetRequest symbol (double underscore). Should you check for SDL_X11_HAVE__XGETREQUEST?

On 2012-01-18 07:59:40 +0000, Ryan C. Gordon wrote:

(In reply to comment # 4)

(1) Does the return keyword mean SDL returns immediately instead of calling the
function from libX11? If do, then why _XFlushGCCache is missing the keyword:

SDL_X11_SYM(void,_XFlushGCCache,(Display* a,GC b),(a,b),)

The "return" is needed if the function doesn't return "void" ... it's a requirement of this macro trick.

I did not find the `_XFlushGCCache' anywhere else in the SDL code, thus I think
it's not used by SDL.

It's used by the FlushGC macro, which the Xv support code uses.

(2) Also you check for SDL_X11_HAVE_XGETREQUEST, but

#define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
SDL_X11_SYM(void ,_XGetRequest,(Display a,CARD8 b,size_t c),(a,b,c),return)

should create SDL_X11_HAVE__XGetRequest symbol (double underscore). Should you
check for SDL_X11_HAVE__XGETREQUEST?

No, it looks for whatever we specified for "modname" in SDL_X11_MODULE, which was "XGETREQUEST".

--ryan.

On 2012-01-18 08:47:18 +0000, Sam Lantinga wrote:

Petr, can you try out the attached patch and see if it works for you?

Thanks!

On 2012-01-19 02:56:20 +0000, Petr Pisar wrote:

Current SDL-1.2 head compiles with the old libX11 as well as with the new libX11.

After applying the patch to SDL-1.2.14, it compiles and works with old libX11. It compiles and works with new libX11.

On 2012-01-19 07:57:31 +0000, Sam Lantinga wrote:

Great, thanks!

On 2012-12-02 06:07:21 +0000, student wrote:

Hi,

Can anyone tell me and help me how to patch SDL librarz?

regards

On 2012-12-03 03:53:49 +0000, Petr Pisar wrote:

(In reply to comment # 9)

Can anyone tell me and help me how to patch SDL librarz?

If you have SDL-1.2.15, you do need to apply this patch because it's already included.

If you have SDL-1.2.14, you need to adjust the patch before applying as it has been created against development SDL tree. Or you can get rebased patch from some distribution archives like this one from Fedora http://pkgs.fedoraproject.org/cgit/SDL.git/plain/SDL-1.2.14-Define__XGetRequest.patch?id=600a62015f44deed7a5e1340a7097157cbf210fe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant