-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Comments
We can unify the behavior, i.e. make 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
} |
Nope, unfortunately that doesn't help. It looks like we're missing an |
I can't build libdecor (don't have its requirements), but if it's missing |
…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.
…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…
Moving the include to line 55 fixes this for me, but breaks the Adding a second, explicit include for the non-dynamic case does work, though is quite ugly: 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 |
Along with your patch, do you needed to patch configure.ac too ? |
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 |
BTW, cmake doesn't seem to implement an equivalent of --enable-libdecor-shared |
Yep, I did those myself :) |
When libdecor is present (and enabled, which is the default) and dynamic wayland support is disabled, build fails.
Reproducer (must have libdecor):
Errors
The text was updated successfully, but these errors were encountered: