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

Build break with --enable-wayland-shared=no and libdecor present #4543

Closed
cgutman opened this issue Jul 27, 2021 · 10 comments
Closed

Build break with --enable-wayland-shared=no and libdecor present #4543

cgutman opened this issue Jul 27, 2021 · 10 comments
Milestone

Comments

@cgutman
Copy link
Collaborator

cgutman commented Jul 27, 2021

When libdecor is present (and enabled, which is the default) and dynamic wayland support is disabled, build fails.

Reproducer (must have libdecor):

./configure --enable-wayland-shared=no
make

Errors

/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h: In function 'SDL_WAYLAND_LoadSymbols':
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:143:23: error: 'libdecor_unref' undeclared (first use in this function)
  143 | SDL_WAYLAND_SYM(void, libdecor_unref, (struct libdecor *))
      |                       ^~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:143:23: note: each undeclared identifier is reported only once for each function it appears in
  143 | SDL_WAYLAND_SYM(void, libdecor_unref, (struct libdecor *))
      |                       ^~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:144:36: error: 'libdecor_new' undeclared (first use in this function); did you mean 'libdecor'?
  144 | SDL_WAYLAND_SYM(struct libdecor *, libdecor_new, (struct wl_display *, struct libdecor_interface *))
      |                                    ^~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:145:42: error: 'libdecor_decorate' undeclared (first use in this function); did you mean 'libdecor_state'?
  145 | SDL_WAYLAND_SYM(struct libdecor_frame *, libdecor_decorate, (struct libdecor *,\
      |                                          ^~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:149:23: error: 'libdecor_frame_unref' undeclared (first use in this function); did you mean 'libdecor_frame_interface'?
  149 | SDL_WAYLAND_SYM(void, libdecor_frame_unref, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:150:23: error: 'libdecor_frame_set_title' undeclared (first use in this function); did you mean 'libdecor_frame_interface'?
  150 | SDL_WAYLAND_SYM(void, libdecor_frame_set_title, (struct libdecor_frame *, const char *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:151:23: error: 'libdecor_frame_set_app_id' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_app_id'?
  151 | SDL_WAYLAND_SYM(void, libdecor_frame_set_app_id, (struct libdecor_frame *, const char *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:152:23: error: 'libdecor_frame_set_max_content_size' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_max_content_size'?
  152 | SDL_WAYLAND_SYM(void, libdecor_frame_set_max_content_size, (struct libdecor_frame *frame,\
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:155:23: error: 'libdecor_frame_set_min_content_size' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_min_content_size'?
  155 | SDL_WAYLAND_SYM(void, libdecor_frame_set_min_content_size, (struct libdecor_frame *frame,\
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:158:23: error: 'libdecor_frame_resize' undeclared (first use in this function); did you mean 'libdecor_frame_interface'?
  158 | SDL_WAYLAND_SYM(void, libdecor_frame_resize, (struct libdecor_frame *,\
      |                       ^~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:162:23: error: 'libdecor_frame_move' undeclared (first use in this function); did you mean 'libdecor_frame'?
  162 | SDL_WAYLAND_SYM(void, libdecor_frame_move, (struct libdecor_frame *,\
      |                       ^~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:165:23: error: 'libdecor_frame_commit' undeclared (first use in this function); did you mean 'libdecor_frame'?
  165 | SDL_WAYLAND_SYM(void, libdecor_frame_commit, (struct libdecor_frame *,\
      |                       ^~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:168:23: error: 'libdecor_frame_set_minimized' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_minimized'?
  168 | SDL_WAYLAND_SYM(void, libdecor_frame_set_minimized, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:169:23: error: 'libdecor_frame_set_maximized' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_maximized'?
  169 | SDL_WAYLAND_SYM(void, libdecor_frame_set_maximized, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:170:23: error: 'libdecor_frame_unset_maximized' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_unset_maximized'?
  170 | SDL_WAYLAND_SYM(void, libdecor_frame_unset_maximized, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:171:23: error: 'libdecor_frame_set_fullscreen' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_fullscreen'?
  171 | SDL_WAYLAND_SYM(void, libdecor_frame_set_fullscreen, (struct libdecor_frame *, struct wl_output *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:172:23: error: 'libdecor_frame_unset_fullscreen' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_unset_fullscreen'?
  172 | SDL_WAYLAND_SYM(void, libdecor_frame_unset_fullscreen, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:173:23: error: 'libdecor_frame_set_capabilities' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_capabilities'?
  173 | SDL_WAYLAND_SYM(void, libdecor_frame_set_capabilities, (struct libdecor_frame *, \
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:175:23: error: 'libdecor_frame_unset_capabilities' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_unset_capabilities'?
  175 | SDL_WAYLAND_SYM(void, libdecor_frame_unset_capabilities, (struct libdecor_frame *, \
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:177:23: error: 'libdecor_frame_has_capability' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_has_capability'?
  177 | SDL_WAYLAND_SYM(bool, libdecor_frame_has_capability, (struct libdecor_frame *, \
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:179:23: error: 'libdecor_frame_set_visibility' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_set_visibility'?
  179 | SDL_WAYLAND_SYM(void, libdecor_frame_set_visibility, (struct libdecor_frame *, bool))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:180:23: error: 'libdecor_frame_is_visible' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_is_visible'?
  180 | SDL_WAYLAND_SYM(bool, libdecor_frame_is_visible, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:181:23: error: 'libdecor_frame_is_floating' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_frame_is_floating'?
  181 | SDL_WAYLAND_SYM(bool, libdecor_frame_is_floating, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:182:23: error: 'libdecor_frame_map' undeclared (first use in this function); did you mean 'libdecor_frame'?
  182 | SDL_WAYLAND_SYM(void, libdecor_frame_map, (struct libdecor_frame *))
      |                       ^~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:183:42: error: 'libdecor_state_new' undeclared (first use in this function); did you mean 'libdecor_state'?
  183 | SDL_WAYLAND_SYM(struct libdecor_state *, libdecor_state_new, (int, int))
      |                                          ^~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:184:23: error: 'libdecor_state_free' undeclared (first use in this function); did you mean 'libdecor_state'?
  184 | SDL_WAYLAND_SYM(void, libdecor_state_free, (struct libdecor_state *))
      |                       ^~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:185:23: error: 'libdecor_configuration_get_content_size' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_configuration_get_content_size'?
  185 | SDL_WAYLAND_SYM(bool, libdecor_configuration_get_content_size, (struct libdecor_configuration *,\
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
/home/cgutman/SDL/src/video/wayland/SDL_waylandsym.h:189:23: error: 'libdecor_configuration_get_window_state' undeclared (first use in this function); did you mean 'WAYLAND_libdecor_configuration_get_window_state'?
  189 | SDL_WAYLAND_SYM(bool, libdecor_configuration_get_window_state, (struct libdecor_configuration *,\
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cgutman/SDL/src/video/wayland/SDL_waylanddyn.c:164:54: note: in definition of macro 'SDL_WAYLAND_SYM'
  164 | #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn;
      |                                                      ^~
make: *** [Makefile:697: build/SDL_waylanddyn.lo] Error 1
make: *** Waiting for unfinished jobs....
@cgutman cgutman added this to the 2.0.16 milestone Jul 27, 2021
@sezero
Copy link
Contributor

sezero commented Jul 27, 2021

We can unify the behavior, i.e. make --disable-wayland-shared to silently
imply --disable-libdecor-shared. Does the following work?

diff --git a/configure.ac b/configure.ac
index 40cfc0d..6db56c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1511,44 +1511,6 @@ CheckWarnAll()
     fi
 }
 
-dnl See if libdecor is available
-CheckLibDecor()
-{
-    AC_ARG_ENABLE(libdecor,
-[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],
-                  , enable_libdecor=yes)
-    if test x$enable_libdecor = xyes; then
-        AC_MSG_CHECKING(for libdecor support)
-        AS_IF([$PKG_CONFIG --exists libdecor-0],
-              [video_libdecor=yes],
-              [video_libdecor=no])
-        AC_MSG_RESULT($video_libdecor)
-        if test x$video_libdecor = xyes; then
-            EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`"
-            AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ])
-
-            AC_ARG_ENABLE(libdecor-shared,
-[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],
-                 , enable_libdecor_shared=yes)
-
-            decor_lib=[`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
-
-            if test x$have_loadso != xyes && \
-               test x$enable_libdecor_shared = xyes; then
-                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading])
-            fi
-
-            if test x$have_loadso = xyes && \
-               test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
-                echo "-- dynamic libdecor -> $decor_lib"
-                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ])
-            else
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`"
-            fi
-        fi
-    fi
-}
-
 dnl Check for Wayland
 CheckWayland()
 {
@@ -1634,7 +1596,44 @@ CheckWayland()
             fi
             have_video=yes
 
-            CheckLibDecor
+dnl See if libdecor is available
+            AC_ARG_ENABLE(libdecor,
+[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],
+                          , enable_libdecor=yes)
+            if test x$enable_libdecor = xyes; then
+                AC_MSG_CHECKING(for libdecor support)
+                AS_IF([$PKG_CONFIG --exists libdecor-0],
+                      [video_libdecor=yes],
+                      [video_libdecor=no])
+                AC_MSG_RESULT($video_libdecor)
+                if test x$video_libdecor = xyes; then
+                    EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`"
+                    AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ])
+
+                    AC_ARG_ENABLE(libdecor-shared,
+[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],
+                         , enable_libdecor_shared=yes)
+
+                    if test x$enable_wayland_shared != xyes; then
+                       enable_libdecor_shared=no
+                    fi
+
+                    decor_lib=[`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
+
+                    if test x$have_loadso != xyes && \
+                       test x$enable_libdecor_shared = xyes; then
+                        AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading])
+                    fi
+
+                    if test x$have_loadso = xyes && \
+                       test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
+                        echo "-- dynamic libdecor -> $decor_lib"
+                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ])
+                    else
+                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`"
+                    fi
+                fi
+            fi
         fi
     fi
 }

@cgutman
Copy link
Collaborator Author

cgutman commented Jul 28, 2021

Nope, unfortunately that doesn't help. SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR isn't enabled anymore, but the same build errors remain.

It looks like we're missing an #include <libdecor.h> somewhere, but I'm not sure where it needs to go. I haven't found where rest of the Wayland includes required to define those other types in SDL_waylandsym.h are coming from.

@sezero
Copy link
Contributor

sezero commented Jul 28, 2021

I can't build libdecor (don't have its requirements), but if it's missing #include <libdecor.h>
how about moving that include from line 119 to line 55 in SDL_waylanddyn.h (with or without
the configury patch)?

sulix added a commit to sulix/SDL that referenced this issue Jul 28, 2021
…g#4543)

When wayland is not dynamically linked (--enable-wayland-shared=no),
libdecor is always also statically linked (it's treated as part of
Wayland in SDL_waylanddyn.{c,h} and SDL_waylandsym.h). However, it
doesn't include libdecor.h unless SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC is
set, so it fails to build at all unless Wayland is dynamically loaded.

This is @sezero's suggested fix of simply moving the libdecor.h include
outside the #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC block:
libsdl-org#4543 (comment)

Note that this doesn't fix any of the underlying issues of libdecor
being treated as part of wayland, it just fixes the build.
sulix added a commit to sulix/SDL that referenced this issue Jul 28, 2021
…g#4543)

When wayland is not dynamically linked (--enable-wayland-shared=no),
libdecor is always also statically linked (it's treated as part of
Wayland in SDL_waylanddyn.{c,h} and SDL_waylandsym.h). However, it
doesn't include libdecor.h unless SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC is
set, so it fails to build at all unless Wayland is dynamically loaded.

We can't simply move the libdecor.h include above the #ifdef
SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC block, as libdecor.h itself #includes
wayland headers we need to replace with #defines. Instead, we duplicate
the #include for the statically linked case.

Note that this doesn't fix any of the underlying issues of libdecor
being treated as part of wayland, it just fixes the build. A better
solution would probably be to decouple the wayland dynamic loading from
the libdecor dynamic loading completely, though that is a lot more work…
@sulix
Copy link
Contributor

sulix commented Jul 28, 2021

Moving the include to line 55 fixes this for me, but breaks the --enable-wayland-shared=yes case. This seems to be because libdecor.h includes wayland-client.h, which can't be included before the SDL_waylanddyn.h bits.

Adding a second, explicit include for the non-dynamic case does work, though is quite ugly:
sulix@4cc269f

It's probably worth either including the configure patch or something similar as well, as the code clearly doesn't support having a dynamically loaded libdecor with a statically linked wayland. Though that could be worth fixing, too, as I could see why you'd want to make libdecor dynamically linked even if everything else was statically linked. (Is the libdecor plugin interface supposed to have a stable ABI?)

Feel free to pull that change (or write a better one, as I'm sure there's an even nicer place to include libdecor.h from) in the meantime, though, if that seems sensible…

@sezero
Copy link
Contributor

sezero commented Jul 28, 2021

Along with your patch, do you needed to patch configure.ac too ?

@sulix
Copy link
Contributor

sulix commented Jul 28, 2021

I didn't patch configure.ac as well, my patch worked alone.

That being said, I suspect the configure.ac patch is probably worth including as well, as the rest of the code does seem to treat treat --disable-wayland-shared as implying --disable-libdecor-shared. I haven't tested it yet, though.

@sezero
Copy link
Contributor

sezero commented Jul 28, 2021

Applied David's patch (with minor edit and commit message tweaks) here:
18303c9

Also applied the configury patch, here: 4a7799b
If it results in issues, let me know (or patch it.)

@sezero
Copy link
Contributor

sezero commented Jul 28, 2021

BTW, cmake doesn't seem to implement an equivalent of --enable-libdecor-shared
unless I'm missing something..

@ericoporto
Copy link
Contributor

ericoporto commented Aug 17, 2021

I think Libdecor is dealt on the lines below here:

if(LIBDECOR_FOUND)

And the option is here:

dep_option(LIBDECOR_SHARED "Dynamically load libdecor support" ON "WAYLAND_LIBDECOR" OFF)

@sezero
Copy link
Contributor

sezero commented Aug 17, 2021

I think Libdecor is dealt on the lines below here:

And the option is here:

Yep, I did those myself :)

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

4 participants