Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.8k stars 715 forks source link

Can't install waybar-hyprland on Arch #2177

Closed joan31 closed 1 year ago

joan31 commented 1 year ago

Hi,

First, a big thanks to developpers for this bar.

So, I'm on Arch Linux and, the package can't be installed (from AUR) cause :+1:

[95/133] Compiling C++ object waybar.p/src_bar.cpp.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: waybar-hyprland-exit status 4
 -> Failed to install the following packages. Manual intervention is required:
waybar-hyprland - exit status 4

For now I use the waybay on the official repos from Arch, but I can't manage workspaces properly. So I'm trying to install this version.

Can you support me to solve this issue please ?

Thanks a lot.

https://aur.archlinux.org/packages/waybar-hyprland

joan31 commented 1 year ago

Ok the problem is from gcc. The latest version is gcc13 in Arch. And compilation does not work properly.

So I've downgraded gcc 13 to version 12 from https://archive.archlinux.org/

# pacman -U gcc-12.2.1-4-x86_64.pkg.tar.zst gcc-libs-12.2.1-4-x86_64.pkg.tar.zst

And after that, I installed waybar-hyprland from AUR with success.

yay -S waybar-hyprland

papppmac commented 1 year ago

This is the same issue reported in https://github.com/Alexays/Waybar/issues/2159 two weeks ago.

There are some no-longer-implict includes in GCC13, so it needs includes for stdexcept and string in modules/sway/ipc/client.hpp.

Since you're installing via AUR, add sed -i '10 i #include <stdexcept>\n#include <string>' include/modules/sway/ipc/client.hpp to the build() of your PKGBUILD and it works fine under GCC13 - much less disruptive than downgrading your system GCC for one package.

(a comment to this effect was at the top of the AUR page when you posted about it there)

joan31 commented 1 year ago

Thank you so much !!! It work.

breadlol64 commented 1 year ago

it dont work for me

hasukomusicvpn commented 1 year ago

This is the same issue reported in #2159 two weeks ago.

There are some no-longer-implict includes in GCC13, so it needs includes for stdexcept and string in modules/sway/ipc/client.hpp.

Since you're installing via AUR, add sed -i '10 i #include <stdexcept>\n#include <string>' include/modules/sway/ipc/client.hpp to the build() of your PKGBUILD and it works fine under GCC13 - much less disruptive than downgrading your system GCC for one package.

(a comment to this effect was at the top of the AUR page when you posted about it there)

can you explain how to use this, I'm new to it, did you mean use the command 'yay -S waybar-hyprland sed -i '10 sed -i '10 i #include \n#include ' include/modules/sway/ipc/client.hpp' like this? Sorry to bother you but I'm new to this and I like the rices on the internet. Hope for your reply

papppmac commented 1 year ago

First and foremost, this bug is closed because the problem has been fixed upstream, and you don't need to do anything. In fact, you probably shouldn't use the waybar-hyprland AUR package at all because AFIK mainline waybar now has all the hyprland support it used to patch in. Just install the waybar package and it'll do the thing.

Just for your reference on AUR usage, my suggestion isn't to put on the command line, it's to edit in the PKGBUILD. After you ran that yay command once (whether the build succeeded or failed), it would leave a directory /home/$USER/.cache/yay/waybar-hyprland containing all the sources and a file named PKGBUILD that describes to arch's build system how to make the package. If you open that file up in a text editor, you can make customizations to the build/install process, and my suggestion was to drop that sed command into the section/function marked build(). What that would do is edit one of the waybar source files before the build with sed (which is itself a text editor; it edits text by structured command instead of on screen) to insert some includes that used to be implicitly pulled in and aren't anymore.

Blueskygod commented 1 year ago

This is the same issue reported in #2159 two weeks ago.

There are some no-longer-implict includes in GCC13, so it needs includes for stdexcept and string in modules/sway/ipc/client.hpp.

Since you're installing via AUR, add sed -i '10 i #include <stdexcept>\n#include <string>' include/modules/sway/ipc/client.hpp to the build() of your PKGBUILD and it works fine under GCC13 - much less disruptive than downgrading your system GCC for one package.

(a comment to this effect was at the top of the AUR page when you posted about it there)

can i get a example how to do it ?

papppmac commented 1 year ago

Strictly as a general interest thing, since the bug is fixed in mainline waybar, AND mainline now has hyprland support so you should just be using the normal repo package, several people have asked about this basic AUR thing here, so let's tutorial :

To use the edit I suggested you would start a normal AUR workflow and download the AUR package directory with git or curl or your AUR helper of choice, then when you go to look at the contents (because you always look at the PKGBUILD when you use AUR packages, in case the uploader has inserted something stupid or malicious, right?), you point your favorite text editor at the PKGBUILD in the folder you downloaded. If you're using a helper, it (1) by default will show the PKGBUILD to you in an editor or pager and (2) will put them in some standard location, eg. paru checks out to ~/.cache/paru/clone/$PKGNAME.

The PKGBUILD file is basically a bash script that contains a couple standard sections/functions like pkgver() and package(), the critical one is build() which contains the instructions for actually building the software. Usually the first thing in build() is a cd into the source directory, then it makes any configurations/changes needed (which is what we want to change in this kind of situation), then it calls make or meson or whatever build system the software uses.

You would insert that sed line in build() just below the cd into the source directory. Sed is a programmatic text editor, being used here to make some quick changes to source files in an automatic way, and if you're building via AUR, the build function of the PKGBUILD is where you should do that sort of thing.

If you look at the (again, now obsolete) waybar-hyprland PKGBUILD it already has a sed line to swap out a line of code for workspace handling for one that makes a hyprctl call... which was, AFIK, actually the only thing special about the waybar-hyprland package relative to mainline. My sed line to fix the code to deal with gcc13 being a little more precise about includes would go right before or after that one, then you would continue with the usual AUR workflow and run makepkg in the same directory as the PKGBUILD you just edited, or tell your helper to proceed with the build.