Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 936020 - media-libs/libsdl2-2.28.5-r1: Fails to compile due to incompatible pointer type
Summary: media-libs/libsdl2-2.28.5-r1: Fails to compile due to incompatible pointer type
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on: 936319
Blocks:
  Show dependency tree
 
Reported: 2024-07-14 05:38 UTC by Alexis
Modified: 2024-08-01 07:05 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Build log (build.log,934.59 KB, text/x-log)
2024-07-14 05:40 UTC, Alexis
Details
Output of `emerge --info` (emerge.info,10.56 KB, text/plain)
2024-07-14 05:40 UTC, Alexis
Details
fix automagic dependency (0001-media-libs-libsdl2-fix-automagic-dependency-on-libde.patch,1.22 KB, patch)
2024-07-19 16:43 UTC, Eli Schwartz
Details | Diff
backport libdecor support to 2.28 (0001-media-libs-libsdl2-wire-up-libdecor-support-for-stab.patch,8.59 KB, patch)
2024-07-19 16:44 UTC, Eli Schwartz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis 2024-07-14 05:38:01 UTC
Will attach full build log and emerge --info forthwith, but the error is:

```
/var/tmp/portage/media-libs/libsdl2-2.28.5-r1/work/SDL2-2.28.5/src/video/wayland/SDL_waylandsym.h: In function 'SDL_WAYLAND_LoadSymbols':
/var/tmp/portage/media-libs/libsdl2-2.28.5-r1/work/SDL2-2.28.5/src/video/wayland/SDL_waylanddyn.c:166:58: error: assignment to 'SDL_DYNWAYLANDFN_libdecor_frame_get_min_content_size' {aka 'void (*)(struct libdecor_frame *, int *, int *)'} from incompatible pointer type 'void (*)(const struct libdecor_frame *, int *, int *)' [-Wincompatible-pointer-types]
  166 | #define SDL_WAYLAND_SYM_OPT(rc, fn, params) WAYLAND_##fn = fn;
      |                                                          ^
/var/tmp/portage/media-libs/libsdl2-2.28.5-r1/work/SDL2-2.28.5/src/video/wayland/SDL_waylandsym.h:222:1: note: in expansion of macro 'SDL_WAYLAND_SYM_OPT'
  222 | SDL_WAYLAND_SYM_OPT(void, libdecor_frame_get_min_content_size, (struct libdecor_frame *,\
      | ^~~~~~~~~~~~~~~~~~~
/var/tmp/portage/media-libs/libsdl2-2.28.5-r1/work/SDL2-2.28.5/src/video/wayland/SDL_waylanddyn.c:166:58: error: assignment to 'SDL_DYNWAYLANDFN_libdecor_frame_get_max_content_size' {aka 'void (*)(struct libdecor_frame *, int *, int *)'} from incompatible pointer type 'void (*)(const struct libdecor_frame *, int *, int *)' [-Wincompatible-pointer-types]
  166 | #define SDL_WAYLAND_SYM_OPT(rc, fn, params) WAYLAND_##fn = fn;
      |                                                          ^
/var/tmp/portage/media-libs/libsdl2-2.28.5-r1/work/SDL2-2.28.5/src/video/wayland/SDL_waylandsym.h:225:1: note: in expansion of macro 'SDL_WAYLAND_SYM_OPT'
  225 | SDL_WAYLAND_SYM_OPT(void, libdecor_frame_get_max_content_size, (struct libdecor_frame *,\
      | ^~~~~~~~~~~~~~~~~~~
make: *** [Makefile:743: build/SDL_waylanddyn.lo] Error 1
```

Reproducible: Always
Comment 1 Alexis 2024-07-14 05:40:16 UTC
Created attachment 897557 [details]
Build log
Comment 2 Alexis 2024-07-14 05:40:42 UTC
Created attachment 897558 [details]
Output of `emerge --info`
Comment 3 Eli Schwartz gentoo-dev 2024-07-16 16:12:00 UTC
I cannot reproduce this; tried with USE='wayland gles2'
Comment 4 Alexis 2024-07-17 00:10:30 UTC
(In reply to Eli Schwartz from comment #3)
> I cannot reproduce this; tried with USE='wayland gles2'

It appears to be the result of GCC 14 - which i'd unintentionally installed - making incompatible-pointer-types an error. When i removed 14 and replaced it with 13, the library compiled successfully. What compiler+version did you compile with?
Comment 5 Eli Schwartz gentoo-dev 2024-07-19 16:18:57 UTC
(In reply to Alexis from comment #4)
> It appears to be the result of GCC 14 - which i'd unintentionally installed
> - making incompatible-pointer-types an error. When i removed 14 and replaced
> it with 13, the library compiled successfully. What compiler+version did you
> compile with?


I tried with gcc 13 and the flags described at https://wiki.gentoo.org/wiki/Modern_C_porting#How_do_I_reproduce_these_bugs.3F to make it report the same errors as gcc 14. ;)

I know where the Werror comes from and how to reproduce it, I simply did not get any compiler diagnostics from there at all!

But, I have figured it out now, in part because the gentoo binhost successfully builds libsdl2 and then fails to build other software because of missing shared libraries.



FAILED: client/SDL/SDL2/sdl-freerdp 
: && /usr/bin/x86_64-pc-linux-gnu-g++ -O2 -pipe -march=x86-64 -mtune=generic -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_utils.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_kbd.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_touch.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_pointer.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_disp.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_monitor.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_freerdp.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_channels.cpp.o client/SDL/SDL2/CMakeFiles/sdl2-freerdp.dir/sdl_window.cpp.o -o client/SDL/SDL2/sdl-freerdp  -Wl,-rpath,/var/tmp/portage/net-misc/freerdp-3.6.3/work/freerdp-3.6.3_build/client/common:/var/tmp/portage/net-misc/freerdp-3.6.3/work/freerdp-3.6.3_build/libfreerdp:/var/tmp/portage/net-misc/freerdp-3.6.3/work/freerdp-3.6.3_build/winpr/libwinpr:  client/common/libfreerdp-client3.so.3.6.3 
  client/SDL/SDL2/dialogs/res/libsdl2_client_res.a  client/SDL/SDL2/dialogs/libsdl2-dialogs.a  client/SDL/common/aad/libsdl-common-aad-view.a  client/SDL/common/libsdl-common-prefs.a  -lfuse3  -lpthread  client/SDL/SDL2/dialogs/res/libsdl2_client_res.a  client/SDL/common/res/libsdl-common-client-res.a  /usr/lib64/libSDL2_ttf-2.0.so.0.2200.0  /usr/lib64/libSDL2.so  libfreerdp/libfreerdp3.so.3.6.3  winpr/libwinpr/libwinpr3.so.3.6.3 && :
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: warning: libdecor-0.so.0, needed by /usr/lib64/libSDL2.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_get_max_content_size'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_unref'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_is_visible'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_fullscreen'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_parent'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_maximized'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_dispatch'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_is_floating'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_max_content_size'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_state_new'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_get_min_content_size'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_state_free'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_map'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_unset_fullscreen'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_title'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_minimized'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_decorate'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_unset_capabilities'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_configuration_get_content_size'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_get_xdg_toplevel'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_has_capability'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_min_content_size'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_capabilities'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_unref'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_get_xdg_surface'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_resize'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_visibility'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_new'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_set_app_id'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_configuration_get_window_state'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_unset_maximized'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_move'
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libSDL2.so: undefined reference to `libdecor_frame_commit'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
 * ERROR: net-misc/freerdp-3.6.3::gentoo failed (compile phase):
 *   ninja -v -j32 -l64 failed



So I tried to figure out why libsdl2 is linking to libdecor but doesn't depend on it -- the libsdl2 configure script automatically checks for libdecor and builds against it if available, but my attempt to install libdecor and demonstrate the overlinking problem caused an incompatible-pointer-type problem, and then I recalled this ticket.
Comment 6 Eli Schwartz gentoo-dev 2024-07-19 16:43:33 UTC
Created attachment 897998 [details, diff]
fix automagic dependency
Comment 7 Eli Schwartz gentoo-dev 2024-07-19 16:44:02 UTC
Created attachment 897999 [details, diff]
backport libdecor support to 2.28
Comment 8 Larry the Git Cow gentoo-dev 2024-07-19 22:57:56 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c19cb386709780fc23cd1141684e32efe585492

commit 9c19cb386709780fc23cd1141684e32efe585492
Author:     Eli Schwartz <eschwartz@gentoo.org>
AuthorDate: 2024-07-19 16:31:23 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-07-19 22:56:42 +0000

    media-libs/libsdl2: fix automagic dependency on libdecor
    
    It is enabled and depended on for the 2.30 ebuilds which use cmake,
    although the cmake builds default to not building with libdecor support.
    
    It is not enabled for the stable 2.28 ebuild which uses autotools,
    although the autotools builds default to detecting libdecor and using
    it.
    
    Closes: https://bugs.gentoo.org/936020
    Closes: https://bugs.gentoo.org/936267
    Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/libsdl2/libsdl2-2.28.5-r1.ebuild | 1 +
 1 file changed, 1 insertion(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f63e002c7e0de47436702f03aebe6a94f58b8dc

commit 9f63e002c7e0de47436702f03aebe6a94f58b8dc
Author:     Eli Schwartz <eschwartz@gentoo.org>
AuthorDate: 2024-07-19 16:41:24 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-07-19 22:57:20 +0000

    media-libs/libsdl2: wire up libdecor support for stable series too
    
    [sam: add Bug: tags.]
    
    Bug: https://bugs.gentoo.org/936020
    Bug: https://bugs.gentoo.org/936267
    Fixes: 1b5e09a485a7c7f756af30aae248aeed5082a877
    Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/libsdl2/libsdl2-2.28.5-r2.ebuild | 266 ++++++++++++++++++++++++++++
 1 file changed, 266 insertions(+)
Comment 9 Eli Schwartz gentoo-dev 2024-07-21 20:23:58 UTC
Sorry, I should NOT have closed this as resolved, oops.

My first thought had been to suppress libdecor entirely, but the later ebuilds enable it whenever wayland is, and I went ahead and backported that due to $REASONS. Which means that we now hit this whenever USE=wayland, as opposed to randomly whenever libdecor happens to be preinstalled.

If only the first patch had been committed it might make sense to call this fixed, but that's not what we did. :P
Comment 10 Larry the Git Cow gentoo-dev 2024-08-01 07:05:51 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4da31bd05ccf902cd7da0e367da45e29c5ff26cc

commit 4da31bd05ccf902cd7da0e367da45e29c5ff26cc
Author:     Sv. Lockal <lockalsash@gmail.com>
AuthorDate: 2024-07-21 16:36:38 +0000
Commit:     Eli Schwartz <eschwartz@gentoo.org>
CommitDate: 2024-08-01 06:59:55 +0000

    media-libs/libsdl2: Fix build with >=gui-libs/libdecor-0.2.0
    
    This applies https://github.com/libsdl-org/SDL/commit/4ce935b9106a0311436e41c5f28f00db30a93de1
    to libsdl2-2.28.
    
    Closes: https://bugs.gentoo.org/936443
    Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/37657
    Closes: https://bugs.gentoo.org/936020
    Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>

 .../files/libsdl2-2.28.5-fix-libdecor-0.2.patch       | 19 +++++++++++++++++++
 media-libs/libsdl2/libsdl2-2.28.5-r2.ebuild           |  1 +
 2 files changed, 20 insertions(+)