SDL/src/video
Sam Lantinga d226594fcc Workaround for bug 3049 - SDL_Init(SDL_INIT_VIDEO) - XDM authorization key matches an existing client!
malferit

Hello, I began a little program with SDL2 on Linux in C, and when I call SDL_Init(SDL_INIT_VIDEO) I get an error and this is printed in the console:

XDM authorization key matches an existing client!

I searched through Internet, and found that some people suggest to run 'xhost +' or to specify this in /etc/X11/xdm/xdm-config:

DisplayManager*authName:        MIT-MAGIC-COOKIE-1

I don't think an end user needs to know that...

But what bothered me is that first I started this little program in Pascal using the Freepascal compiler and it works. In freepascal you only use some thin header bindings in Pascal and then it links with the dynamic SDL library, so I don't understood why it worked with Freepascal and not in C.

I run ldd to the two generated applications:

Application in C:

	linux-gate.so.1 (0xffffe000)
	libSDL2-2.0.so.0 => /usr/lib/libSDL2-2.0.so.0 (0xb76ac000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb766e000)
	libc.so.6 => /lib/libc.so.6 (0xb74e2000)
	libm.so.6 => /lib/libm.so.6 (0xb74a0000)
	libdl.so.2 => /lib/libdl.so.2 (0xb749a000)
	librt.so.1 => /lib/librt.so.1 (0xb7491000)
	/lib/ld-linux.so.2 (0xb77b3000)

Application compiled with Freepascal:

	linux-gate.so.1 (0xffffe000)
	libSDL2-2.0.so.0 => /usr/lib/libSDL2-2.0.so.0 (0xb762a000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0xb74f3000)
	libc.so.6 => /lib/libc.so.6 (0xb7367000)
	libm.so.6 => /lib/libm.so.6 (0xb7325000)
	libdl.so.2 => /lib/libdl.so.2 (0xb731f000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb7305000)
	librt.so.1 => /lib/librt.so.1 (0xb72fc000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb72dc000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0xb72d9000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb72d3000)
	/lib/ld-linux.so.2 (0xb7755000)

It seems that Freepascal is linking with libX11, libxcb, libXau and libXdmcp .

Linking my C application with libxcb solved the problem (linking with libXau and/or libXdmcp without libxcb didn't work). Linking with X11 links all the other libraries and works as well.

So I fill this bug report mainly to let you know about this. I don't know if it is a problem that can be solved on the libSDL side or not, but at least I hope it will help.

Hi, some tests:

1. Disabled XDM. Login in console and running 'startx'. The program works without having to link with X11.

2. Enabled XDM. Added 'DisplayManager*authName: MIT-MAGIC-COOKIE-1' to /etc/X11/xdm/xdm-config.The program works without having to link with X11.

3. Enabled XDM without 'DisplayManager*authName: MIT-MAGIC-COOKIE-1' in /etc/X11/xdm/xdm-config . I get the authentication error unless I link with X11.
2017-08-12 16:48:46 -07:00
..
android Fixed bug 3128 - Removing all the static variables from android SDLActivity and accompanying JNI calls. 2017-08-12 12:24:59 -07:00
cocoa Fixed bug 3697 - Main thread gets stuck on left mouse down 2017-08-01 20:16:10 -07:00
directfb directfb: Fixed quitting keyboard twice. 2017-06-16 23:30:30 +02:00
dummy Updated copyright for 2017 2017-01-01 18:33:28 -08:00
emscripten emscripten: Fixed compiling without OpenGL support. 2017-08-05 22:10:48 +02:00
haiku haiku: Fixed compiler warning. 2017-08-09 18:30:48 -04:00
kmsdrm Fixed bug 3723 - Possible double free in kmsdrm init code on certain errors 2017-08-11 10:05:45 -07:00
mir mir: Removed unnecessary function declaration. 2017-08-05 22:10:15 +02:00
nacl nacl: Fixed freeing static memory on video quit. 2017-08-05 22:10:25 +02:00
pandora pandora: Fixed compile error. 2017-06-16 23:30:38 +02:00
psp Fixed SDL_GetWindowWMInfo() returning success on three unsupported platforms. 2017-06-15 23:30:29 +02:00
qnx Fixed compiler warnings on QNX. 2017-07-23 19:25:16 -04:00
raspberry Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
uikit iOS: Use modern replacements for deprecated functions, when available. 2017-07-15 17:41:58 -03:00
vivante Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
wayland Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
windows Fixed bug 3058 - Slight mistake in GetWindowStyle in SDL_windowswindow.c 2017-08-12 16:44:00 -07:00
winrt Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
x11 Workaround for bug 3049 - SDL_Init(SDL_INIT_VIDEO) - XDM authorization key matches an existing client! 2017-08-12 16:48:46 -07:00
SDL_blit.c Fixed crash in bug 3367 - RGBA_FROM_PIXEL macro can't handle SDL_PIXELFORMAT_ARGB2101010 2017-08-11 18:56:41 -07:00
SDL_blit.h Really fixed blit issue for capehill 2017-01-07 16:51:48 -08:00
SDL_blit_0.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_1.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_A.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_blit_auto.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_auto.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_copy.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_N.c Fixed comment style. 2017-02-26 21:20:39 +01:00
SDL_blit_slow.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_blit_slow.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_bmp.c Fix some more compiler warnings on armcc. 2017-03-03 16:38:17 -05:00
SDL_clipboard.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_egl.c Fixed bug 3702 - Clear error messages of SDL_LoadObject for optional libraries 2017-08-11 10:21:19 -07:00
SDL_egl_c.h Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
SDL_fillrect.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_pixels.c Fixed bug 3158 - SDL display window scrambled over VNC 2017-08-12 16:02:33 -07:00
SDL_pixels_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_rect_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_RLEaccel.c Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_RLEaccel_c.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_shape.c Fixed bug 3699 - Shaped windows are distorted unless width is divisible by 8 2017-07-11 08:16:00 -07:00
SDL_shape_internals.h Updated copyright for 2017 2017-01-01 18:33:28 -08:00
SDL_stretch.c Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
SDL_surface.c Fixed bug 3309 - SDL_ConvertSurface adds AlphaMod when input surface has ColorKey 2017-08-12 15:21:26 -07:00
SDL_sysvideo.h Fixed bug 3690 - SDL2 KMS/DRM render context support 2017-08-02 10:22:48 -07:00
SDL_video.c Fixed bug 3173 - SDL_GL_GetAttribute overwrites error code from SDL_GL_GetProcAddress 2017-08-12 15:55:54 -07:00
sdlgenblit.pl Updated copyright for 2017 2017-01-01 18:33:28 -08:00