# This bug report was migrated from our old Bugzilla tracker.
These attachments… are available in the static archive:
* [Proposed fix (SDL-1.2.15-const_XData32.patch, text/plain, 2013-03-27 11:24:46 +0000, 646 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1078)
* [libsdl-1.2-fix-compilation-libX11.patch (libsdl-1.2-fix-compilation-libX11.patch, text/plain, 2013-06-02 11:05:44 +0000, 2253 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1166)
* [libsdl2-fix-compilation-libX11.patch (libsdl2-fix-compilation-libX11.patch, text/plain, 2013-06-02 11:06:41 +0000, 5199 bytes)](https://bugzilla.libsdl.org/attachment.cgi?id=1167)
**Reported in version:** 1.2.15
**Reported for operating system, platform:** Linux, x86_64
# Comments on the original bug report:
On 2013-03-27 11:03:30 +0000, Petr Pisar wrote:
> When building libsdl-1.2.15 against libX11-1.5.99.901 on x86_64, I get error on mismatching _XData32 declaration:
>
> gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -D_REENTRANT -DXTHREADS -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -c ./src/video/x11/SDL_x11dyn.c -fPIC -DPIC -o build/.libs/SDL_x11dyn.o
> ./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for '_XData32'
> SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
> ^
> ./src/video/x11/SDL_x11dyn.c:95:5: note: in definition of macro 'SDL_X11_SYM'
> rc fn params { ret p##fn args ; }
> ^
> In file included from ./src/video/x11/SDL_x11dyn.h:34:0,
> from ./src/video/x11/SDL_x11dyn.c:26:
> /usr/include/X11/Xlibint.h:595:12: note: previous declaration of '_XData32' was here
> extern int _XData32(
> ^
> make: *** [build/SDL_x11dyn.lo] Error 1
>
>
> This is due to changes in libX11 coming with commit:
>
> commit f0b171c8ea7b055ba520272ea9a2604e18841ac7
> Author: Alan Coopersmith <alan.coopersmith@oracle.com>
> Date: Fri Feb 15 23:34:40 2013 -0800
>
> Preserve constness in casting arguments through the Data*() routines
>
> Casts were annoying gcc by dropping constness when changing types,
> when routines simply either copy data into the request buffer or
> send it directly to the X server, and never modify the input.
>
> Fixes gcc warnings including:
> ChProp.c: In function 'XChangeProperty':
> ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> ChProp.c:65:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> ChProp.c:74:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> ChProp.c:83:6: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> SetHints.c: In function 'XSetStandardProperties':
> SetHints.c:262:20: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> SetPntMap.c: In function 'XSetPointerMapping':
> SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> SetPntMap.c:46:5: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> StBytes.c: In function 'XStoreBuffer':
> StBytes.c:97:33: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> StName.c: In function 'XStoreName':
> StName.c:40:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
> StName.c: In function 'XSetIconName':
> StName.c:51:27: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
>
> Relevant change in <X11/Xlibint.h> is:
>
> extern int _XData32(
> Display *dpy,
> - register long *data,
> + register _Xconst long *data,
> unsigned len
> );
>
> Reading SDL 1.2 and 2 hg repositories, I believe both of them are affected.
On 2013-03-27 11:24:46 +0000, Petr Pisar wrote:
> Created attachment 1078
> Proposed fix
On 2013-05-29 04:31:26 +0000, Nikos Chantziaras wrote:
> Bug is still there in SDL 2.0.0 RC1.
On 2013-05-29 06:29:01 +0000, Sam Lantinga wrote:
> Ryan, can you fix this for SDL 2.0 release?
>
> Thanks!
On 2013-06-01 07:56:03 +0000, Ellie wrote:
> I filed # 1875 for SDL 2
On 2013-06-01 07:57:39 +0000, Ellie wrote:
> *** Bug 1875 has been marked as a duplicate of this bug. ***
On 2013-06-02 07:16:49 +0000, Azamat H. Hackimov wrote:
> Proposed patch is not backward compatible with libX11 < 1.5.99.901.
On 2013-06-02 11:05:44 +0000, Azamat H. Hackimov wrote:
> Created attachment 1166
> libsdl-1.2-fix-compilation-libX11.patch
>
> This patch for SDL 1.2 is backward compatible with old libX11 version. Please test it.
On 2013-06-02 11:06:41 +0000, Azamat H. Hackimov wrote:
> Created attachment 1167
> libsdl2-fix-compilation-libX11.patch
>
> Patch for SDL2, cmake and autotools.
On 2013-06-02 23:14:09 +0000, Sam Lantinga wrote:
> Fix looks good, thanks! :)
On 2013-06-02 23:52:39 +0000, Azamat H. Hackimov wrote:
> Will you apply patch for SDL 1.2?
On 2013-06-05 04:50:25 +0000, Marcus von Appen wrote:
> (In reply to comment # 10)
> > Will you apply patch for SDL 1.2?
>
> Badly needed for any platform with a recent xorg :-).
On 2013-06-06 02:41:53 +0000, Sam Lantinga wrote:
> Yep, added 1.2 patch, thanks!
> http://hg.libsdl.org/SDL/rev/91ad7b43317a
On 2014-01-08 17:10:51 +0000, Vicente Olivert Riera wrote:
> (In reply to Sam Lantinga from comment # 12)
> > Yep, added 1.2 patch, thanks!
> > http://hg.libsdl.org/SDL/rev/91ad7b43317a
>
> In that patch you are modifying configure.in to define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32, so autoreconf should be ran to make those changes take effect. The problem is that autoreconf fails: https://bugzilla.libsdl.org/show_bug.cgi?id=2340
On 2014-01-08 19:21:18 +0000, Azamat H. Hackimov wrote:
> (In reply to Vicente Olivert Riera from comment # 13)
> > (In reply to Sam Lantinga from comment # 12)
> > > Yep, added 1.2 patch, thanks!
> > > http://hg.libsdl.org/SDL/rev/91ad7b43317a
> >
> > In that patch you are modifying configure.in to define
> > SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32, so autoreconf should be ran to
> > make those changes take effect. The problem is that autoreconf fails:
> > https://bugzilla.libsdl.org/show_bug.cgi?id=2340
>
> Your problem not directly related to this bug, I added comment to your bug.
On 2016-05-18 09:21:11 +0000, WSC wrote:
> There is a regression in v1.2.15, xdata32 patch disappeared:
>
> arch: x86_64
> uname -r: 4.5.2-1
> libX11-6: 1.6.3-2.14
> --------------------
> wget -O - http://www.libsdl.org/release/SDL-1.2.15.tar.gz | gunzip | tar -xf -
> cd SDL-1.2.15
> grep -i xdata32 configure.in || echo 'No such!'
> No such!
>
>
>
>
> ---------
>
> /bin/sh ./libtool --mode=compile gcc -g -O2 -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -D_REENTRANT -DXTHREADS -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -c ./src/video/x11/SDL_x11dyn.c -o build/SDL_x11dyn.lo
> libtool: compile: gcc -g -O2 -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -D_REENTRANT -DXTHREADS -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -c ./src/video/x11/SDL_x11dyn.c -fPIC -DPIC -o build/.libs/SDL_x11dyn.o
> ./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for '_XData32'
> SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
> ^
> ./src/video/x11/SDL_x11dyn.c:95:5: note: in definition of macro 'SDL_X11_SYM'
> rc fn params { ret p##fn args ; }
> ^
> In file included from ./src/video/x11/SDL_x11dyn.h:34:0,
> from ./src/video/x11/SDL_x11dyn.c:26:
> /usr/include/X11/Xlibint.h:681:12: note: previous declaration of '_XData32' was here
> extern int _XData32(
> ^
> build-deps:1178: recipe for target 'build/SDL_x11dyn.lo' failed
> make: *** [build/SDL_x11dyn.lo] Error 1
On 2016-05-18 09:28:10 +0000, Azamat H. Hackimov wrote:
> This patch intended to appear in 1.2.16, not in 1.2.15. If you have problems with 1.2.15, you need apply patch manually.
On 2018-07-31 08:31:21 +0000, Ozkan Sezer wrote:
> Closing this: the fix is already in SDL-1.2 branch.