mihirlad55 / polybar-dwm-module

A dwm module for polybar
MIT License
116 stars 15 forks source link

Build error - polybar:randr-output #10

Closed ranjithshegde closed 4 years ago

ranjithshegde commented 4 years ago

Build Process

Describe how you build polybar, list the exact commands you are using: This repository

If you build polybar directly from this repository:

Build Log

Post everything that is output to the terminal while building polybar below. This HAS to include the output of the cmake and make commands, if you used them.

❯ ./build.sh -d
** Fetching submodules

** A build dir already exists (pass -f to replace)

** Setting build options

** Use GCC even if Clang is installed ----------------------------- [y/N]: y
** Include support for "internal/i3" (requires i3) ---------------- [y/N]: n
** Include support for "internal/alsa" (requires alsalib) --------- [y/N]: y
** Include support for "internal/pulseaudio" (requires libpulse) -- [y/N]: y
** Include support for "internal/network" (requires libnl/libiw) -- [y/N]: ^C
❯ ./build.sh -d
** Fetching submodules

** A build dir already exists (pass -f to replace)

** Setting build options

** Use GCC even if Clang is installed ----------------------------- [y/N]: y
** Include support for "internal/i3" (requires i3) ---------------- [y/N]: n
** Include support for "internal/alsa" (requires alsalib) --------- [y/N]: y
** Include support for "internal/pulseaudio" (requires libpulse) -- [y/N]: n
** Include support for "internal/network" (requires libnl/libiw) -- [y/N]: y
** Include support for "internal/mpd" (requires libmpdclient) ----- [y/N]: n
** Include support for "internal/github" (requires libcurl) ------- [y/N]: y
** Build "polybar-msg" used to send ipc messages ------------------ [y/N]: y
** Parallelize the build using make -j12 --------------------------- [y/N]: y
** Executing cmake command

-- Trying to enable ccache
-- Couldn't locate ccache, disabling ccache...
-- No build type specified; using Release
-- Using supported compiler GNU-10.1.0
--  Build:
--    Version: 3.4.0-167-g3278b0a
--    Type: Release
--    CXX: /usr/bin/g++  -Wall -Wextra -Wpedantic -O3 -DNDEBUG
--    LD: /usr/bin/ld
--  Install Paths:
--    PREFIX:  /usr/local
--    BINDIR:  /usr/local/bin
--    DATADIR: /usr/local/share
--    DOCDIR:  /usr/local/share/doc/polybar
--    MANDIR:  /usr/local/share/man
--  Targets:
-- [X]   polybar-msg
-- [ ]   testsuite
-- [ ]   documentation
--  Module support:
-- [X]   alsa (1.2.3.2)
-- [X]   curl (7.71.1)
-- [X]   dwm
-- [ ]   i3
-- [ ]   mpd
-- [X]   network (libnl) (3.5.0)
-- [ ]   pulseaudio
-- [X]   xkeyboard (1.14)
--  X extensions:
-- [X]   xcb-randr (1.14)
-- [X]   xcb-randr (monitor support) (1.14)
-- [X]   xcb-composite (1.14)
-- [X]   xcb-xkb (1.14)
-- [ ]   xcb-xrm
-- [ ]   xcb-cursor
--  Log options:
-- [X]   Trace logging
-- XCB[XCB]: Found component XCB
-- XCB[ICCCM]: Found component ICCCM
-- XCB[EWMH]: Found component EWMH
-- XCB[UTIL]: Found component UTIL
-- XCB[IMAGE]: Found component IMAGE
-- Found XCB: /usr/lib/libxcb.so;/usr/lib/libxcb-icccm.so;/usr/lib/libxcb-ewmh.so;/usr/lib/libxcb-util.so;/usr/lib/libxcb-image.so
-- Searching for xcbgen with /usr/bin/python3
-- Found xcbgen in /usr/lib/python3.8/site-packages
-- XCB[RANDR]: Found component RANDR
-- Found XCB: /usr/lib/libxcb.so;/usr/lib/libxcb-icccm.so;/usr/lib/libxcb-ewmh.so;/usr/lib/libxcb-util.so;/usr/lib/libxcb-image.so;/usr/lib/libxcb-randr.so
-- XCB[COMPOSITE]: Found component COMPOSITE
-- Found XCB: /usr/lib/libxcb.so;/usr/lib/libxcb-icccm.so;/usr/lib/libxcb-ewmh.so;/usr/lib/libxcb-util.so;/usr/lib/libxcb-image.so;/usr/lib/libxcb-randr.so;/usr/lib/libxcb-composite.so
-- XCB[XKB]: Found component XKB
-- Found XCB: /usr/lib/libxcb.so;/usr/lib/libxcb-icccm.so;/usr/lib/libxcb-ewmh.so;/usr/lib/libxcb-util.so;/usr/lib/libxcb-image.so;/usr/lib/libxcb-randr.so;/usr/lib/libxcb-composite.so;/usr/lib/libxcb-xkb.so
-- xpp: including xcb proto composite.xml
-- xpp: including xcb proto randr.xml
-- xpp: including xcb proto xkb.xml
-- xpp: including xcb proto xproto.xml
-- Font not found: fixed:pixelsize=10
-- Font not found: unifont:fontformat=truetype
-- Font not found: siji:pixelsize=10
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ranjith/Software/polybar-dwm-module/build
** Building project

[  5%] Built target xpp
[ 10%] Built target polybar-msg
[ 17%] Built target dwmipcpp
[ 18%] Building CXX object bin/CMakeFiles/poly.dir/modules/dwm.cpp.o
/home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp: In member function ‘void polybar::modules::dwm_module::update_monitor_ref()’:
/home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:325:21: error: invalid use of incomplete type ‘const struct polybar::randr_output’
  325 |       if (geom.x == bmon.x && geom.y == bmon.y && geom.width == bmon.w && geom.height == bmon.h) {
      |                     ^~~~
In file included from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/base.hpp:10,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/event_module.hpp:3,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/dwm.hpp:5,
                 from /home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:1:
/home/ranjith/Software/polybar-dwm-module/include/components/types.hpp:13:8: note: forward declaration of ‘struct polybar::randr_output’
   13 | struct randr_output;
      |        ^~~~~~~~~~~~
/home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:325:41: error: invalid use of incomplete type ‘const struct polybar::randr_output’
  325 |       if (geom.x == bmon.x && geom.y == bmon.y && geom.width == bmon.w && geom.height == bmon.h) {
      |                                         ^~~~
In file included from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/base.hpp:10,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/event_module.hpp:3,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/dwm.hpp:5,
                 from /home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:1:
/home/ranjith/Software/polybar-dwm-module/include/components/types.hpp:13:8: note: forward declaration of ‘struct polybar::randr_output’
   13 | struct randr_output;
      |        ^~~~~~~~~~~~
/home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:325:65: error: invalid use of incomplete type ‘const struct polybar::randr_output’
  325 |       if (geom.x == bmon.x && geom.y == bmon.y && geom.width == bmon.w && geom.height == bmon.h) {
      |                                                                 ^~~~
In file included from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/base.hpp:10,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/event_module.hpp:3,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/dwm.hpp:5,
                 from /home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:1:
/home/ranjith/Software/polybar-dwm-module/include/components/types.hpp:13:8: note: forward declaration of ‘struct polybar::randr_output’
   13 | struct randr_output;
      |        ^~~~~~~~~~~~
/home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:325:90: error: invalid use of incomplete type ‘const struct polybar::randr_output’
  325 |       if (geom.x == bmon.x && geom.y == bmon.y && geom.width == bmon.w && geom.height == bmon.h) {
      |                                                                                          ^~~~
In file included from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/base.hpp:10,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/meta/event_module.hpp:3,
                 from /home/ranjith/Software/polybar-dwm-module/include/modules/dwm.hpp:5,
                 from /home/ranjith/Software/polybar-dwm-module/src/modules/dwm.cpp:1:
/home/ranjith/Software/polybar-dwm-module/include/components/types.hpp:13:8: note: forward declaration of ‘struct polybar::randr_output’
   13 | struct randr_output;
      |        ^~~~~~~~~~~~
make[2]: *** [bin/CMakeFiles/poly.dir/build.make:485: bin/CMakeFiles/poly.dir/modules/dwm.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:547: bin/CMakeFiles/poly.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
** Failed to build project

Environment:

Additional context

Add any other context that you think is necessary about the problem here. Followed the README - all steps

mihirlad55 commented 4 years ago

Could you please try running build again with the following command and post the full log:

./build.sh -d -f
vide0hanz commented 4 years ago

I have the exact same issue, here is my logfile

log.txt

mihirlad55 commented 4 years ago

Ok, I've discovered the issue. I believe, for some reason the way that polybar includes files, struct randr_output isn't defined before it is used in the dwm module when you don't have xcb-util-xrm installed. I was able to replicate the exact error on my system after uninstalling that package. I'm not fully certain yet if that package is a dependency for struct randr_output (it wouldn't make sense for it to be), but as a temporary fix for now, if you install xcb-util-xrm, it should build without errors. Please try that and let me know if that fixes it. In the meantime, I will try to figure out if this package is really necessary to fix this error.

mihirlad55 commented 4 years ago

Ok after adding #include "x11/extensions/randr.hpp" in dwm.cpp, I was able to build polybar without xcb-util-xrm installed. I'm still not really sure why this package causes the struct to not fully be defined.

mihirlad55 commented 4 years ago

I figured it out. This was the include hierarchy:

dwm.cpp
    > components/config.hpp
        > x11/xresources.hpp (if xcb-util-xrm installed)
            > x11/connection.hpp
                > x11/extensions.all.hpp
                    > x11/extensions/randr.hpp

If xcb-util-xrm wasn't installed, the x11/extensions/randr.hpp would never get included causing the build to fail.

mihirlad55 commented 4 years ago

Merged to master in commit 01add486afb6b6d5effe2462673ca0f2f7076fdc. @ranjithshegde @vide0hanz Please confirm if this fixed the issue.

vide0hanz commented 4 years ago

Nice! Yup, builds 100% on my end now. Thank you very much.

ranjithshegde commented 4 years ago

@mihirlad55 Just tried your PR. Works like a charm! Thank you very much!