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

Build fails if sdbus-cpp 1.2.0 headers are installed. #191

Open
cgevans opened this issue Feb 22, 2024 · 2 comments
Open

Build fails if sdbus-cpp 1.2.0 headers are installed. #191

cgevans opened this issue Feb 22, 2024 · 2 comments

Comments

@cgevans
Copy link

cgevans commented Feb 22, 2024

It appears that, if sdbus-cpp is not installed, then 1.4.0 will be built. If 1.4.0 is system-installed, then the build will also work. However, if an earlier version (eg, 1.2.0 is the latest version in Fedora 39) is installed, the build will fail (see below). The version of sdbus-cpp should probably be checked, if it is found.

xdg-desktop-portal-hyprland on  master via △ v3.27.7 
❯ cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DCMAKE_INSTALL_PREFIX=/usr -B build
-- 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...
-- 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.6.0", minimum required is "0.5.0") 
-- Found WrapVulkanHeaders: /usr/include  
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.9.5") 
-- 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.0
--   Found wayland-protocols, version 1.33
--   Found libpipewire-0.3, version 1.0.3
--   Found libspa-0.2, version 0.2
--   Found libdrm, version 2.4.120
--   Found gbm, version 23.3.5
--   Found hyprlang, version 0.4.0
-- Checking for module 'sdbus-c++'
--   Found sdbus-c++, version 1.2.0
-- Checking for module 'hyprland-protocols'
--   Found hyprland-protocols, version 0.2
-- Found WaylandScanner at /usr/bin/wayland-scanner
-- Found wayland-protocols at //usr/share/wayland-protocols
-- Configuring done (1.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/const/devel/xdg-desktop-portal-hyprland/build

xdg-desktop-portal-hyprland on  master via △ v3.27.7 
❯ cmake --build build
[  4%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/core/PortalManager.cpp.o
In file included from /home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:1:
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:93:14: error: ‘condition_variable’ in namespace ‘std’ does not name a type
   93 |         std::condition_variable loopSignal;
      |              ^~~~~~~~~~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:17:1: note: ‘std::condition_variable’ is defined in header ‘<condition_variable>’; did you forget to ‘#include <condition_variable>’?
   16 | #include <mutex>
  +++ |+#include <condition_variable>
   17 | 
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:95:33: error: field ‘shouldProcess’ has incomplete type ‘std::atomic<bool>’
   95 |         std::atomic<bool>       shouldProcess = false;
      |                                 ^~~~~~~~~~~~~
In file included from /usr/include/c++/13/bits/shared_ptr_atomic.h:33,
                 from /usr/include/c++/13/memory:81,
                 from /home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:3:
/usr/include/c++/13/bits/atomic_base.h:174:12: note: declaration of ‘struct std::atomic<bool>’
  174 |     struct atomic;
      |            ^~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:100:14: error: ‘condition_variable’ in namespace ‘std’ does not name a type
  100 |         std::condition_variable              loopSignal;
      |              ^~~~~~~~~~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:100:9: note: ‘std::condition_variable’ is defined in header ‘<condition_variable>’; did you forget to ‘#include <condition_variable>’?
  100 |         std::condition_variable              loopSignal;
      |         ^~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:104:30: error: ‘thread’ is not a member of ‘std’
  104 |         std::unique_ptr<std::thread>         thread;
      |                              ^~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:17:1: note: ‘std::thread’ is defined in header ‘<thread>’; did you forget to ‘#include <thread>’?
   16 | #include <mutex>
  +++ |+#include <thread>
   17 | 
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:104:36: error: template argument 1 is invalid
  104 |         std::unique_ptr<std::thread>         thread;
      |                                    ^
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:104:36: error: template argument 2 is invalid
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.hpp:104:14: error: ‘<expression error>’ in namespace ‘std’ does not name a type
  104 |         std::unique_ptr<std::thread>         thread;
      |              ^~~~~~~~~~~~~~~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In lambda function:
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:376:39: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘loopSignal’
  376 |                 m_sEventLoopInternals.loopSignal.notify_all();
      |                                       ^~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In member function ‘void CPortalManager::startEventLoop()’:
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:381:21: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘thread’
  381 |     m_sTimersThread.thread = std::make_unique<std::thread>([this] {
      |                     ^~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In lambda function:
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:395:29: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘loopSignal’
  395 |             m_sTimersThread.loopSignal.wait_for(lk, std::chrono::milliseconds((int)nearest), [this] { return m_sTimersThread.shouldProcess; });
      |                             ^~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:416:39: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘loopSignal’
  416 |                 m_sEventLoopInternals.loopSignal.notify_all();
      |                                       ^~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In member function ‘void CPortalManager::startEventLoop()’:
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:427:35: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘loopSignal’
  427 |             m_sEventLoopInternals.loopSignal.wait(lk, [this] { return m_sEventLoopInternals.shouldProcess == true; }); // wait for events
      |                                   ^~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:492:21: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘thread’
  492 |     m_sTimersThread.thread.release();
      |                     ^~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In member function ‘void CPortalManager::addTimer(const CTimer&)’:
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:554:21: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘loopSignal’
  554 |     m_sTimersThread.loopSignal.notify_all();
      |                     ^~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp: In member function ‘void CPortalManager::terminate()’:
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:567:31: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘loopSignal’
  567 |         m_sEventLoopInternals.loopSignal.notify_all();
      |                               ^~~~~~~~~~
/home/const/devel/xdg-desktop-portal-hyprland/src/core/PortalManager.cpp:571:21: error: ‘struct CPortalManager::<unnamed>’ has no member named ‘loopSignal’
  571 |     m_sTimersThread.loopSignal.notify_all();
      |                     ^~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-address-of-temporary’ may have been intended to silence earlier diagnostics
gmake[2]: *** [CMakeFiles/xdg-desktop-portal-hyprland.dir/build.make:76: CMakeFiles/xdg-desktop-portal-hyprland.dir/src/core/PortalManager.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:101: CMakeFiles/xdg-desktop-portal-hyprland.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
@Nilsia
Copy link

Nilsia commented Feb 27, 2024

I fixed the problem with just adding the header file
#include <condition_variable> at the recommended place.

however after these packages compiled :

[  4%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/core/PortalManager.cpp.o
[  8%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/helpers/Log.cpp.o
[ 13%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/helpers/MiscFunctions.cpp.o
[ 17%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/helpers/Timer.cpp.o
[ 21%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/main.cpp.o
[ 26%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/portals/GlobalShortcuts.cpp.o

I have this :

xdg-desktop-portal-hyprland/src/portals/GlobalShortcuts.cpp:58:10: error: no match for ‘operator>>’ (operand types are ‘sdbus::MethodCall’ and ‘std::unordered_map<std::__cxx11::basic_string<char>, sdbus::Variant>’)
   58 |     call >> opts;
      |     ~~~~ ^~ ~~~~
      |     |       |
      |     |       std::unordered_map<std::__cxx11::basic_string<char>, sdbus::Variant>
      |     sdbus::MethodCall

Thanks

@cgevans
Copy link
Author

cgevans commented Feb 27, 2024

Yes, I should have clarified: the error message I pasted there is just the first error that shows up, a symptom of needing sdbus-cpp 1.4.0, not 1.2.0. Fixing that symptom just results in another error. The build process needs to be changed to depend on 1.4.0.

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