We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5142 - Generated SDL2 Makefile has bug with missing dependency file for Wayland protocol file, breaks build
Summary: Generated SDL2 Makefile has bug with missing dependency file for Wayland prot...
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-16 13:24 UTC by Ellie
Modified: 2020-07-12 06:19 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ellie 2020-05-16 13:24:56 UTC
On Fedora 32, I can't get SDL2 to compile even with wayland-devel and kwin-devel installed, I am just getting this: (on Ubuntu 18 LTS it works fine btw)

ake[3]: Leaving directory '/compile-tree/vendor/SDL-mirror'
make[3]: Entering directory '/compile-tree/vendor/SDL-mirror'
mkdir -p -- gen
  GEN    gen/org-kde-kwin-server-decoration-manager-client-protocol.h
  GEN    gen/pointer-constraints-unstable-v1-client-protocol.h
  GEN    gen/relative-pointer-unstable-v1-client-protocol.h
  GEN    gen/wayland-client-protocol.h
  GEN    gen/xdg-decoration-unstable-v1-client-protocol.h
  GEN    gen/xdg-shell-unstable-v6-client-protocol.h
  GEN    gen/xdg-shell-client-protocol.h
  GEN    gen/org-kde-kwin-server-decoration-manager-protocol.c
Using "code" is deprecated - use private-code or public-code.
See the help page for details.
  CC     build/org-kde-kwin-server-decoration-manager-protocol.lo
gen/org-kde-kwin-server-decoration-manager-protocol.c:60:1: fatal error: opening dependency file build/org-kde-kwin-server-decoration-manager-protocol.d: No such file or directory
 };
 ^
compilation terminated

Sadly, Google comes up blank on this error, and it doesn't really tell me what sort of system-wide file is missing either (so people can use "apt-file find" or alike).

I am wondering about the following things:

1. would it be possible to make the error actually point out the exact file that is missing system-wide? (It only seems to indirectly fail generation of a local file in the SDL2 tree, but I assume this is due to some system-wide file being missing the error doesn't mention)

2. since this sounds KDE-specific, is this feature essential for Wayland support, or could this be feature-detection gated? If this just provides optional special integration with KDE, then maybe it'd be preferable if it didn't block the build

Just as a side note, I am also getting this error on Ubuntu (where the build usually works) when using the Aarch64 cross-compiler to target raspberry pi and such, and it's both more difficult to rely on more obscure header files in such an environment and also to add them in manually after the fact as a "regular" dev. But the Linux mobile space definitely appears to be moving towards Wayland as the way to go, so this is a bit unsatisfactory. Therefore, feature-detecting could also help to make SDL2 easier to build for more obscure Wayland targets, assuming this KWin functionality isn't vital for proper operation of course.
Comment 1 Ellie 2020-05-19 16:45:40 UTC
For what it's worth, now the build is failing for me on Ubuntu too, with the same error. So I can't actually manage to get the Wayland support to build anywhere. I wonder if this some obscure race condition or unclean-rebuild bug that can manifest on any platform? But I don't even know what "gen" is or what it does, so I find it hard to tell what really is going on
Comment 2 Ellie 2020-05-24 14:09:57 UTC
Ok, so I played around a bit with the generated Makefile resulting from bash ./autogen.sh && ./configure ./configure --disable-video-opengles1 --disable-video-vulkan --enable-sse3 --disable-oss --disable-jack --enable-static --disable-shared --enable-ssemath

... and the following direct change to the Makefile fixes it:

Find this block:

$(objects)/org-kde-kwin-server-decoration-manager-protocol.lo: $(gen)/org-kde-kwin-server-decoration-manager-protocol.c $(gen)/org-kde-kwin-server-decoration-manager-client-protocol.h
    $(RUN_CMD_CC)$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MMD -MT $@ -c $< -o $@


Alter it to:

$(objects)/org-kde-kwin-server-decoration-manager-protocol.lo: $(gen)/org-kde-kwin-server-decoration-manager-protocol.c $(gen)/org-kde-kwin-server-decoration-manager-client-protocol.h
    mkdir -p build
    gcc -M $(gen)/org-kde-kwin-server-decoration-manager-protocol.c > build/org-kde-kwin-server-decoration-manager-protocol.d.$$;
    sed 's,\(foo\)\.o[ :]*,\1.o foo.d : ,g' < build/org-kde-kwin-server-decoration-manager-protocol.d.$$ > $(gen)/org-kde-kwin-server-decoration-manager-protocol.d;
    rm -f build/org-kde-kwin-server-decoration-manager-protocol.d.$$
    $(LIBTOOL) --tag=CC --mode=compile $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MMD -MT $@ -c $< -o $@

This suggests to me that either the Makefile.in or configure.ac script of SDL2 is broken and should be changed such that this step is somehow generated. It would be pretty good if this could be fixed, because this seems to break the build with Wayland on both Fedora 32 and Ubuntu 18.04 under some conditions (or always? I'm not sure yet).
Comment 3 Ellie 2020-07-12 03:27:31 UTC
Has there been any progress on this?

It's kind of ugly to use my suggested workaround, since 1. it requires altering the Makefile which has a high risk of clashes and chaos if any minor thing about it changes, 2. it creates a new "build" folder that isn't actually supposed to be there, but I'm not sure what the exact 'proper' equivalent would be that SDL2's Makefile runs since it's all so indirect.

So working around this is basically pretty smelly and almost guaranteed to be a future source of maintenance trouble, at least if done as shoddily as I managed to. A proper fix would be very helpful
Comment 4 Ryan C. Gordon 2020-07-12 06:19:06 UTC
(In reply to Ellie from comment #3)
> A proper fix would be very helpful

I have to look at this more closely, but it's probably the extremely scary looking WAYLAND_PROTOCOL_DEPENDS code in configure.ac where this fix needs to be made.

--ryan.
Comment 5 Ryan C. Gordon 2020-07-12 06:19:57 UTC
WAYLAND_PROTOCOLS_DEPENDS, plural, not WAYLAND_PROTOCOL_DEPENDS, singular, sorry.