hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
273 stars 47 forks source link

Something is messed up in 1.3.0 build #151

Closed alerque closed 8 months ago

alerque commented 8 months ago

I'm trying to bump Arch Linux packages to v1.3.0 and hitting an unexpected error during build:

[18/33] Compiling C++ object src/xdg-desktop-portal-hyprland.p/core_PortalManager.cpp.o
FAILED: src/xdg-desktop-portal-hyprland.p/core_PortalManager.cpp.o
c++ -Isrc/xdg-desktop-portal-hyprland.p -Isrc -I../src -I. -I.. -Iprotocols -I../protocols -I -I/usr/include/libdrm -I/usr/include/pipewire-0.3 -I/usr/include/spa-0.2 -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith -Wno-unused-parameter -
Wno-unused-value -fpermissive -std=c++23 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/xdg-desktop-portal-hyprland/src=/usr/src/debug/xdg-desktop-portal-hyprland -flto=auto -fPIE
 -pthread -D_REENTRANT -MD -MQ src/xdg-desktop-portal-hyprland.p/core_PortalManager.cpp.o -MF src/xdg-desktop-portal-hyprland.p/core_PortalManager.cpp.o.d -o src/xdg-desktop-portal-hyprland.p/core_PortalManager.cpp.o -c ../src/core/PortalManager.cpp
In file included from ../src/core/PortalManager.hpp:14,
                 from ../src/core/PortalManager.cpp:1:
/usr/include/xf86drm.h:40:10: fatal error: drm.h: No such file or directory
   40 | #include <drm.h>
      |          ^~~~~~~
compilation terminated.

This is somewhat strange since xf86drm.h is not only installed by the package libdrm, but also provided side by side with libdrm/drm.h. I'm unsure what could be coming on here but something got cross-wired. Most probably the wlroots supplied drm.h is getting cross-wired with libdrm's somehow.

Does this trigger any ideas?

vaxerski commented 8 months ago

No clue how this could happen, looking at the changes: https://github.com/hyprwm/xdg-desktop-portal-hyprland/compare/v1.2.6...v1.3.0

I don't see any red flags. Is this meson or cmake?

CMake for me works fine, but I'll ping @fufexan for meson.

alerque commented 8 months ago

The packaging currently uses Meson, but I recently packaged hyprlang using pure CMake (since it was the only available build system in that case) and noticed hyprpaper can now be built with pure CMake too. If that's the way this is headed I can migrate that way, the Meson way of setting up subprojects was just a bit easier before.

fufexan commented 8 months ago

Meson received no changes apart from adding hyprlang as a dependency, and it builds fine in Nix. Not sure what the issue might be.

If that's the way this is headed I can migrate that way, the Meson way of setting up subprojects was just a bit easier before.

I don't know yet, I'll talk about it with Vaxry. We'll probably want to settle on only using one of the build systems.

fufexan commented 8 months ago

We've decided to go with CMake (and no more Makefile) everywhere in the org. Meson will be gradually phased out.

alerque commented 8 months ago

I just tried switching from Meson to CMake, but that doesn't seem to be a go either for different reasons. @vaxerski mentioned using CMake, but given the current Makefile and other bits I'm guessing that Ninja is still required behind the scenes and CMake only works with the Ninja backend. The sdbus-cpp submodule doesn't support CMake as a backend.

As mentioned elsewhere I have my own preferences on build systems but don't care that much about what this project uses (one or many) but the cross-wiring of them through daisy chains (Makefile being used to call CMake which uses Ninja as a backend, etc.) is a constant source of problems downstream.

vaxerski commented 8 months ago
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`

built fine for me

image

Maybe try bisecting to find which commit is the problematic one?

alerque commented 8 months ago

Are you in a clean chroot with relatively few system things available or is sdbus-cpp possibly being found already built on your system so you're skipping the submodule build stage?

vaxerski commented 8 months ago

it's building the submodule, I don't have sdbus-cpp installed:

out ``` cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` Not searching for unused variables given on the command line. -- The C compiler identification is GNU 13.2.1 -- The CXX compiler identification is GNU 13.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring XDPH in Release with CMake -- Checking deps... -- Found PkgConfig: /usr/bin/pkg-config (found version "2.1.0") -- Checking for module 'libsystemd>=236' -- Found libsystemd, version 255 -- Building with libsystemd v255 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Building with documentation -- Found Doxygen: /usr/bin/doxygen (found version "1.9.8") found components: doxygen dot -- Checking for modules 'wayland-client;wayland-protocols;libpipewire-0.3;libspa-0.2;libdrm;gbm;hyprlang>=0.2.0' -- Found wayland-client, version 1.22.90 -- Found wayland-protocols, version 1.32 -- Found libpipewire-0.3, version 1.0.0 -- Found libspa-0.2, version 0.2 -- Found libdrm, version 2.4.119 -- Found gbm, version 23.3.1-arch1.1 -- Found hyprlang, version 0.2.1 -- Found WaylandScanner at /usr/bin/wayland-scanner -- Found wayland-protocols at //usr/share/wayland-protocols -- Configuring done (1.0s) -- Generating done (0.0s) -- Build files have been written to: /home/vaxry/GitHub/xdg-desktop-portal-hyprland/build [ 6%] Built target hyprland-share-picker_autogen_timestamp_deps [ 15%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/Types.cpp.o [ 12%] Building C object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/VTableUtils.c.o [ 12%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/Object.cpp.o [ 12%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/Proxy.cpp.o [ 21%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/SdBus.cpp.o [ 21%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/Flags.cpp.o [ 12%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/Message.cpp.o [ 24%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/Connection.cpp.o [ 27%] Building CXX object subprojects/sdbus-cpp/CMakeFiles/sdbus-c++-objlib.dir/src/Error.cpp.o cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C [ 30%] Automatic MOC and UIC for target hyprland-share-picker cc1: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics [ 30%] Built target hyprland-share-picker_autogen [ 33%] Building CXX object hyprland-share-picker/CMakeFiles/hyprland-share-picker.dir/hyprland-share-picker_autogen/mocs_compilation.cpp.o [ 36%] Building CXX object hyprland-share-picker/CMakeFiles/hyprland-share-picker.dir/main.cpp.o [ 39%] Building CXX object hyprland-share-picker/CMakeFiles/hyprland-share-picker.dir/mainpicker.cpp.o [ 39%] Built target sdbus-c++-objlib [ 42%] Linking CXX static library libsdbus-c++.a [ 42%] Built target sdbus-c++ [ 57%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/portals/Screenshot.cpp.o [ 60%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/helpers/Log.cpp.o [ 60%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/main.cpp.o [ 60%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/portals/Screencopy.cpp.o [ 57%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/core/PortalManager.cpp.o [ 63%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/helpers/Timer.cpp.o [ 66%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/shared/ScreencopyShared.cpp.o [ 60%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/portals/GlobalShortcuts.cpp.o [ 69%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/helpers/MiscFunctions.cpp.o [ 75%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/shared/Session.cpp.o [ 75%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/shared/ToplevelManager.cpp.o [ 78%] Building C object CMakeFiles/xdg-desktop-portal-hyprland.dir/protocols/wlr-foreign-toplevel-management-unstable-v1-protocol.c.o cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C cc1: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics [ 81%] Building C object CMakeFiles/xdg-desktop-portal-hyprland.dir/protocols/wlr-screencopy-unstable-v1-protocol.c.o cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C cc1: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics [ 84%] Building C object CMakeFiles/xdg-desktop-portal-hyprland.dir/protocols/hyprland-global-shortcuts-v1-protocol.c.o cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C cc1: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics [ 87%] Building C object CMakeFiles/xdg-desktop-portal-hyprland.dir/protocols/hyprland-toplevel-export-v1-protocol.c.o cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C cc1: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics [ 90%] Building C object CMakeFiles/xdg-desktop-portal-hyprland.dir/protocols/linux-dmabuf-unstable-v1-protocol.c.o cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C cc1: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics [ 93%] Linking CXX executable hyprland-share-picker [ 96%] Built target hyprland-share-picker [100%] Linking CXX executable xdg-desktop-portal-hyprland [100%] Built target xdg-desktop-portal-hyprland ```
alerque commented 8 months ago

Okay so the issue is the opposite of my first guess: the pure CMake build does work from a Git clone with submodules or if you fetch the sdbus-cpp tarballs for the right commit. The problem I have with that is a subsequent cmake --install actually installs sdbus-cpp in a non-vendored normal location (/usr/include/sdbus-c++). This will obviously conflict with the actual system package. Meanwhile if I try to use the system package instead it just doesn't find it. If the submodule directory doesn't exist I think it should be looking on the system for it, but it isn't doing that, it's insisting on trying to build it specifically as as subproject.

vaxerski commented 8 months ago

uh-huh. Interesting it came out just now. @fufexan should fix this shortly

fufexan commented 8 months ago

@alerque should be fixed in https://github.com/hyprwm/xdg-desktop-portal-hyprland/commit/f46cff1df2d83b826193665091b843cb7776d20c. Sorry it took so long, I'm a CMake noob.

alerque commented 8 months ago

...well we did start out with a Meson problem and then switched gears to CMake half way through. Meson handles the submodules better in this case and finds the system libs properly. We've basically traded one problem for another so the root cause of the second issue took a bit to dig out ;-)

alerque commented 8 months ago

Patching with f46cff1 does fix the sdbus-c++ snafu.

I think we can close this now even though the original Meson issue is not resolved if this project is moving to just support CMake anyway.

I opened a separate issue for my next problem with CMake.

fufexan commented 8 months ago

Thanks, working on fixing that now.

jbeich commented 8 months ago

the original Meson issue is not resolved

See https://github.com/hyprwm/hyprlang/issues/11

amplexus commented 7 months ago

Are you in a clean chroot with relatively few system things available or is sdbus-cpp possibly being found already built on your system so you're skipping the submodule build stage?

Yeah that was my problem - I couldn't built it because it was picking up an old/wrong version of libsdbus-c++-dev.

The README.md says to install required dependencies like sdbus-cpp. And it doesn't mention to git clone --recurse-submodules. Once I apt remove libsdbus-c++-dev (yes, I'm running Ubuntu), and git cloned with --recurse-submodules I could build it successfully.