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

Disabling the WAYLIB_USE_PERCOMPILE_HEADERS option is causes compilation to fail with error: invalid use of incomplete type ‘const struct wlr_output_impl’ #611

Open
daf0x opened this issue Jan 18, 2025 · 2 comments

Comments

@daf0x
Copy link

daf0x commented Jan 18, 2025

Hi, I'm trying to compile release waylib-0.6.10_alpha and I'm running into the below error. I'm not sure how to resolve it.
I have installed qwlroots-0.5.2 and wlroots-0.18.1.

extra qwlroots configuration: -DDISABLE_WLR_PROTOCOLS=yes
extra waylib configuration: -DBUILD_TESTS=no -DDISABLE_XWAYLAND=yes -DBUILD_EXAMPLES=no -DINSTALL_TINYWL=no -DADDRESS_SANITIZER=no

I also removed the line 27 pkg_search_module(WLR_PROTOCOLS REQUIRED wlr-protocols) from server/CMakeLists.txt because I don't have that specific package and I think it's not needed. wlr-protocols is superseded by wayland-protocols is it not?

...

cmake -C /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=no -DDISABLE_XWAYLAND=yes -DBUILD_EXAMPLES=no -DINSTALL_TINYWL=no -DADDRESS_SANITIZER=no -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/gentoo_toolchain.cmake /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha
loading initial cache file /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/gentoo_common_config.cmake
-- The CXX compiler identification is GNU 14.2.1
-- The C compiler identification is GNU 14.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Found OpenGL: /usr/lib64/libOpenGL.so
-- Found WrapOpenGL: TRUE
-- Found XKB: /usr/lib64/libxkbcommon.so (found suitable version "1.7.0", minimum required is "0.5.0")
-- Found WrapVulkanHeaders: /usr/include
-- Found PkgConfig: /usr/bin/x86_64-pc-linux-gnu-pkg-config (found version "2.3.0")
-- Checking for module 'wlroots-0.18=0.18.1'
--   Found wlroots-0.18, version 0.18.1
-- Checking for module 'wayland-server'
--   Found wayland-server, version 1.23.1
-- Checking for module 'pixman-1'
--   Found pixman-1, version 0.44.2
-- Checking for module 'xkbcommon'
--   Found xkbcommon, version 1.7.0
-- Checking for module 'wayland-protocols'
--   Found wayland-protocols, version 1.38
-- Create wayland protocols outputdir: /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/protocols
-- Checking for one of the modules 'libdrm'
-- Checking for one of the modules 'wayland-server'
-- Checking for one of the modules 'xcb'
-- Checking for one of the modules 'egl'

...

[11/87] /usr/bin/x86_64-pc-linux-gnu-g++ -DDISABLE_XWAYLAND -DLIBWAYLIB_SERVER_LIBRARY -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMETA_LIB -DQT_QMLMODELS_LIB -DQT_QMLWORKERSCRIPT_LIB -DQT_QML_LIB -DQT_QUICK_LIB -DWLR_USE_UNSTABLE -Dwaylibserver_EXPORTS -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/src/server -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/src/server/waylibserver_autogen/include -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/protocols -I/usr/include/qt6/QtQml/6.8.1 -I/usr/include/qt6/QtQml/6.8.1/QtQml -I/usr/include/qt6/QtCore/6.8.1 -I/usr/include/qt6/QtCore/6.8.1/QtCore -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/qtquick -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/qtquick/private -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/utils -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/protocols -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/protocols/private -I/usr/include/qt6/QtGui/6.8.1 -I/usr/include/qt6/QtGui/6.8.1/QtGui -I/usr/include/qt6/QtDBus/6.8.1 -I/usr/include/qt6/QtDBus/6.8.1/QtDBus -I/usr/include/qt6/QtQuick/6.8.1 -I/usr/include/qt6/QtQuick/6.8.1/QtQuick -I/usr/include/qt6/QtNetwork/6.8.1 -I/usr/include/qt6/QtNetwork/6.8.1/QtNetwork -I/usr/include/qt6/QtQmlMeta/6.8.1 -I/usr/include/qt6/QtQmlMeta/6.8.1/QtQmlMeta -I/usr/include/qt6/QtQmlModels/6.8.1 -I/usr/include/qt6/QtQmlModels/6.8.1/QtQmlModels -I/usr/include/qt6/QtQmlWorkerScript/6.8.1 -I/usr/include/qt6/QtQmlWorkerScript/6.8.1/QtQmlWorkerScript -I/usr/include/qt6/QtOpenGL/6.8.1 -I/usr/include/qt6/QtOpenGL/6.8.1/QtOpenGL -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib64/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtQml -isystem /usr/include/qt6/QtQmlIntegration -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtQuick -isystem /usr/include/qt6/QtQmlMeta -isystem /usr/include/qt6/QtQmlModels -isystem /usr/include/qt6/QtQmlWorkerScript -isystem /usr/include/qt6/QtOpenGL -isystem /usr/include/wlroots-0.18 -isystem /usr/include/libdrm -isystem /usr/include/pixman-1 -isystem /usr/include/elogind -isystem /usr/lib64/libffi/include -isystem /usr/include/qwlroots  -march=core2 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -O2 -pipe -fno-semantic-interposition -mfpmath=sse      -flto           -Werror=odr     -Werror=lto-type-mismatch        -Werror=strict-aliasing         -fgcse-after-reload     -floop-interchange      -fpeel-loops    -fpredictive-commoning  -ftree-partial-pre      -floop-block    -fgraphite-identity -std=gnu++20 -fPIC -fPIC -MD -MT src/server/CMakeFiles/waylibserver.dir/kernel/woutput.cpp.o -MF src/server/CMakeFiles/waylibserver.dir/kernel/woutput.cpp.o.d -o src/server/CMakeFiles/waylibserver.dir/kernel/woutput.cpp.o -c /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel/woutput.cpp
FAILED: src/server/CMakeFiles/waylibserver.dir/kernel/woutput.cpp.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DDISABLE_XWAYLAND -DLIBWAYLIB_SERVER_LIBRARY -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMETA_LIB -DQT_QMLMODELS_LIB -DQT_QMLWORKERSCRIPT_LIB -DQT_QML_LIB -DQT_QUICK_LIB -DWLR_USE_UNSTABLE -Dwaylibserver_EXPORTS -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/src/server -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/src/server/waylibserver_autogen/include -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha_build/protocols -I/usr/include/qt6/QtQml/6.8.1 -I/usr/include/qt6/QtQml/6.8.1/QtQml -I/usr/include/qt6/QtCore/6.8.1 -I/usr/include/qt6/QtCore/6.8.1/QtCore -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/qtquick -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/qtquick/private -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/utils -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/protocols -I/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/protocols/private -I/usr/include/qt6/QtGui/6.8.1 -I/usr/include/qt6/QtGui/6.8.1/QtGui -I/usr/include/qt6/QtDBus/6.8.1 -I/usr/include/qt6/QtDBus/6.8.1/QtDBus -I/usr/include/qt6/QtQuick/6.8.1 -I/usr/include/qt6/QtQuick/6.8.1/QtQuick -I/usr/include/qt6/QtNetwork/6.8.1 -I/usr/include/qt6/QtNetwork/6.8.1/QtNetwork -I/usr/include/qt6/QtQmlMeta/6.8.1 -I/usr/include/qt6/QtQmlMeta/6.8.1/QtQmlMeta -I/usr/include/qt6/QtQmlModels/6.8.1 -I/usr/include/qt6/QtQmlModels/6.8.1/QtQmlModels -I/usr/include/qt6/QtQmlWorkerScript/6.8.1 -I/usr/include/qt6/QtQmlWorkerScript/6.8.1/QtQmlWorkerScript -I/usr/include/qt6/QtOpenGL/6.8.1 -I/usr/include/qt6/QtOpenGL/6.8.1/QtOpenGL -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib64/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtQml -isystem /usr/include/qt6/QtQmlIntegration -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtQuick -isystem /usr/include/qt6/QtQmlMeta -isystem /usr/include/qt6/QtQmlModels -isystem /usr/include/qt6/QtQmlWorkerScript -isystem /usr/include/qt6/QtOpenGL -isystem /usr/include/wlroots-0.18 -isystem /usr/include/libdrm -isystem /usr/include/pixman-1 -isystem /usr/include/elogind -isystem /usr/lib64/libffi/include -isystem /usr/include/qwlroots  -march=core2 -msse4.1 -mxsave --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=6144 -O2 -pipe -fno-semantic-interposition -mfpmath=sse      -flto           -Werror=odr     -Werror=lto-type-mismatch       -Werror=strict-aliasing          -fgcse-after-reload     -floop-interchange      -fpeel-loops    -fpredictive-commoning  -ftree-partial-pre      -floop-block    -fgraphite-identity -std=gnu++20 -fPIC -fPIC -MD -MT src/server/CMakeFiles/waylibserver.dir/kernel/woutput.cpp.o -MF src/server/CMakeFiles/waylibserver.dir/kernel/woutput.cpp.o.d -o src/server/CMakeFiles/waylibserver.dir/kernel/woutput.cpp.o -c /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel/woutput.cpp
/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel/woutput.cpp: In function ‘bool Waylib::Server::output_pick_cursor_format(wlr_output*, wlr_drm_format*, uint32_t)’:
/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel/woutput.cpp:385:21: error: invalid use of incomplete type ‘const struct wlr_output_impl’
  385 |     if (output->impl->get_cursor_formats) {
      |                     ^~
In file included from /usr/include/qwlroots/qwoutput.h:11,
                 from /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel/woutput.h:8,
                 from /var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel/woutput.cpp:4:
/usr/include/wlroots-0.18/wlr/types/wlr_output.h:114:8: note: forward declaration of ‘struct wlr_output_impl’
  114 | struct wlr_output_impl;
      |        ^~~~~~~~~~~~~~~
/var/tmp/portage/dev-libs/waylib-0.6.10_alpha/work/waylib-0.6.10-alpha/src/server/kernel/woutput.cpp:387:25: error: invalid use of incomplete type ‘const struct wlr_output_impl’
  387 |             output->impl->get_cursor_formats(output, allocator->buffer_caps);
      |                         ^~
/usr/include/wlroots-0.18/wlr/types/wlr_output.h:114:8: note: forward declaration of ‘struct wlr_output_impl’
  114 | struct wlr_output_impl;
      |        ^~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.

Looking for the definition of struct wlr_output_impl:

$ grep -r wlr_output_impl /usr/include/*wlroots*/
/usr/include/wlroots-0.18/wlr/types/wlr_output.h:struct wlr_output_impl;
/usr/include/wlroots-0.18/wlr/types/wlr_output.h:       const struct wlr_output_impl *impl;
/usr/include/wlroots-0.18/wlr/interfaces/wlr_output.h:struct wlr_output_impl {
/usr/include/wlroots-0.18/wlr/interfaces/wlr_output.h:  const struct wlr_output_impl *impl, struct wl_event_loop *event_loop,

struct wlr_output_impl is defined in wlr/interfaces/wlr_output.h, but I can't see an include path from waylib-0.6.10-alpha/src/server/kernel/woutput.cpp to that file. Via types/qwoutput.h in qwlroots only <wlr/types/wlr_output.h> appears to be included, not <wlr/interfaces/wlr_output.h>?

I'm not sure what information is useful to include, please let me know if anything is needed.

@daf0x daf0x changed the title Compilation error: invalid use of incomplete type ‘const struct wlr_output_impl’ Disabling the WAYLIB_USE_PERCOMPILE_HEADERS option is causes compilation to fail with error: invalid use of incomplete type ‘const struct wlr_output_impl’ Jan 19, 2025
@daf0x
Copy link
Author

daf0x commented Jan 19, 2025

I figured out the problem. The issue is that without pre-compiled headers this package does not compile. At least the following files are missing #include directives that are exclusively found in pch/pch.hxx:

  • src/server/kernel/woutput.cpp
  • src/server/kernel/wsurface.cpp
  • src/server/kernel/woutputlayout.cpp
  • src/server/qtquick/woutputrenderwindow.cpp
  • src/server/qtquick/wquickoutputlayout.cpp
  • src/server/qtquick/wrenderhelper.cpp
  • src/server/qtquick/wsgtextureprovider.cpp
  • src/server/utils/wtools.cpp
  • src/server/utils/wimagebuffer.cpp
  • src/server/protocols/wxdgpopupsurface.cpp
  • src/server/protocols/wxdgtoplevelsurface.cpp
  • src/server/protocols/wxwaylandsurface.cpp
  • src/server/protocols/winputpopupsurface.cpp

This means that the WAYLIB_USE_PERCOMPILE_HEADERS option is currently broken.

Common best practice when using pre-compiled headers in a project is to enable them only for developers, to speed up compilation during development. However, when building a release or CI build pre-compiled headers should NOT be used. This approach allows developers to enjoy faster builds while ensuring that CI builds remain consistent and reproducible.

Even with WAYLIB_USE_PERCOMPILE_HEADERS=on ninja did not seem to want to generate or use the pre-compiled header. I am not sure how or if it's related, but please do note that the default stance of Gentoo appears to be to not support pre-compiled headers: https://github.com/gentoo/gentoo/blob/12d10fba7c53fa06425b3c28d347ecd8ce35a55b/profiles/base/use.mask#L55 .

@wineee
Copy link
Member

wineee commented Jan 20, 2025

It should be noted that wlr-protocols is still required, and it's source code is in https://gitlab.freedesktop.org/wlroots/wlr-protocols. wlr-protocols is an extended set of wayland-protocols, which contains many protocols that are very useful for treeland, such as layer-shell, output-management.

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

2 participants