swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.62k stars 1.11k forks source link

Build Error after wlroot!4803 #8308

Closed Billli11 closed 2 months ago

Billli11 commented 2 months ago

Please fill out the following:

With MR4803
when in wlr_output_event_present has benn changed.

diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index bf80f585..6227f047 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -263,7 +263,7 @@ struct wlr_output_event_present {
        // Whether the frame was presented at all.
        bool presented;
        // Time when the content update turned into light the first time.
-       struct timespec *when;
+       struct timespec when;
        // Vertical retrace counter. Zero if unavailable.
        unsigned seq;
        // Prediction of how many nanoseconds after `when` the very next output

Removing a asterisk in sway/desktop/output.c fix building but I don't know enough programing to know if this is the correct fix.

diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 72f753b0..a71430fe 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -465,7 +465,7 @@ static void handle_present(struct wl_listener *listener, void *data) {
                return;
        }

-       output->last_presentation = *output_event->when;
+       output->last_presentation = output_event->when;
        output->refresh_nsec = output_event->refresh;
 }
emersion commented 2 months ago

Fixed by https://github.com/swaywm/sway/pull/8307

swapnanil1 commented 2 months ago

Issue with Compilation

I'm encountering the same issue when trying to build Sway. The build fails until I remove the * in the line that assigns output_event->when to output->last_presentation. It seems like this might be a bug or an oversight.

Here’s a detailed description of the problem and my workaround:

Error Log

[swapnanil@ch sway]$ ninja -C build/ ninja: Entering directory `build/' [12/235] Compiling C object sway/sway.p/desktop_output.c.o FAILED: sway/sway.p/desktop_output.c.o cc -Isway/sway.p -Isway -I../sway -Iinclude -I../include -Iprotocols -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/json-c -I/usr/include/libevdev-1.0 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/wlroots-0.19 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O0 -g -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -Wno-unused-parameter -Wno-unused-result -Wno-missing-braces -Wno-format-zero-length -Wundef -Wvla '-DSYSCONFDIR="//usr/local/etc"' '-DSWAY_VERSION="1.10-dev-7288f77b (" DATE ", branch '"'"'master'"'"')"' -fmacro-prefix-map=../= -pthread -MD -MQ sway/sway.p/desktop_output.c.o -MF sway/sway.p/desktop_output.c.o.d -o sway/sway.p/desktop_output.c.o -c ../sway/desktop/output.c ../sway/desktop/output.c: In function ‘handle_present’: ../sway/desktop/output.c:468:37: error: incompatible types when assigning to type ‘struct timespec’ from type ‘struct timespec *’ 468 | output->last_presentation = output_event->when; | ^~~~ [25/235] Compiling C object sway/sway.p/commands_exec_always.c.o ninja: build stopped: subcommand failed.

Workaround

After modifying the line to dereference the pointer:

output->last_presentation = *output_event->when;

The build completes successfully:

ninja -C build/ ninja: Entering directory `build/' [211/211] Linking target sway/sway

sudo ninja -C build/ install ninja: Entering directory `build/' [0/1] Installing files. Installing sway.1 to /usr/local/share/man/man1 Installing sway.5 to /usr/local/share/man/man5 Installing sway-bar.5 to /usr/local/share/man/man5 Installing sway-input.5 to /usr/local/share/man/man5 Installing sway-ipc.7 to /usr/local/share/man/man7 Installing sway-output.5 to /usr/local/share/man/man5 Installing swaybar-protocol.7 to /usr/local/share/man/man7 Installing swaymsg.1 to /usr/local/share/man/man1 Installing swaynag.1 to /usr/local/share/man/man1 Installing swaynag.5 to /usr/local/share/man/man5 Installing sway/sway to /usr/local/bin Installing swaymsg/swaymsg to /usr/local/bin Installing swaybar/swaybar to /usr/local/bin Installing swaynag/swaynag to /usr/local/bin Installing /home/swapnanil/repos/sway/build/config to /usr/local/etc/sway Installing /home/swapnanil/repos/sway/sway.desktop to /usr/local/share/wayland-sessions Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_768x1024.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_768x1024_Portrait.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_1136x640.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_1136x640_Portrait.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_1366x768.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_1920x1080.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_2048x1536.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/assets/Sway_Wallpaper_Blue_2048x1536_Portrait.png to /usr/local/share/backgrounds/sway Installing /home/swapnanil/repos/sway/completions/zsh/_sway to /usr/local/share/zsh/site-functions Installing /home/swapnanil/repos/sway/completions/zsh/_swaymsg to /usr/local/share/zsh/site-functions Installing /home/swapnanil/repos/sway/completions/bash/sway to /usr/local/share/bash-completion/completions Installing /home/swapnanil/repos/sway/completions/bash/swaymsg to /usr/local/share/bash-completion/completions Installing /home/swapnanil/repos/sway/completions/bash/swaybar to /usr/local/share/bash-completion/completions Installing /home/swapnanil/repos/sway/completions/fish/sway.fish to /usr/local/share/fish/vendor_completions.d Installing /home/swapnanil/repos/sway/completions/fish/swaymsg.fish to /usr/local/share/fish/vendor_completions.d Installing /home/swapnanil/repos/sway/completions/fish/swaynag.fish to /usr/local/share/fish/vendor_completions.d ...