hyprwm / hyprpicker

A wlroots-compatible Wayland color picker that does not suck.
BSD 3-Clause "New" or "Revised" License
670 stars 30 forks source link

Segmentation fault (core dumped) #51

Open knarkzel opened 9 months ago

knarkzel commented 9 months ago

I'm using the latest package on NixOS. I just upgraded to the Nvidia 545 driver. It was working before. This one, v0.2.0: hyprpicker

~ ❯ hyprpicker
Segmentation fault (core dumped)
~ ❯ hyprpicker -h
Hyprpicker usage: hyprpicker [arg [...]].

Arguments:
 -a | --autocopy          | Automatically copies the output to the clipboard (requires wl-clipboard)
 -f | --format=fmt        | Specifies the output format (cmyk, hex, rgb, hsl, hsv)
 -n | --no-fancy          | Disables the "fancy" (aka. colored) outputting
 -h | --help              | Show this help message
 -r | --render-inactive   | Render (freeze) inactive displays
 -z | --no-zoom           | Disable the zoom lens

image

vaxerski commented 9 months ago

try -git, it had some safety improvements.

ckx commented 9 months ago

Same behavior for me after building from source on Fedora. No Nvidia drivers involved on my system.

FWIW the precompiled binary available under releases is giving me a couple dependency errors. It was looking for libjpeg at /usr/lib64/libjpeg.so.8 but mine was at /usr/lib64/libjpeg.so—easy enough to resolve, but the next error is a libc error that I dunno how to resolve. I have a feeling it would just segfault anyway though.

Gxnum commented 7 months ago

I am having the same issue in NixOS as well.

linuxtim commented 6 months ago

To get some useful data out of this, you can create a backtrace: https://stackoverflow.com/questions/5745215/getting-stacktrace-from-core-dump

In my case (Intel drivers) I get:

(gdb) bt full
#0  wl_proxy_get_version (proxy=0x0) at ../src/wayland-client.c:2212
No locals.
#1  0x000000000040e725 in zwlr_screencopy_manager_v1_capture_output (
    zwlr_screencopy_manager_v1=0x0, overlay_cursor=0, output=0x450620)
    at /home/tim/prog/hyprpicker/./wlr-screencopy-unstable-v1-protocol.h:170
        frame = 0x44f770
#2  0x000000000040c02c in CHyprpicker::init (this=0x44a770)
    at /home/tim/prog/hyprpicker/src/hyprpicker.cpp:36
        m = std::unique_ptr<SMonitor> = {get() = 0x44f5d0}
        __for_range = std::vector of length 1, capacity 1 = {std::unique_ptr<SMonitor> = {
            get() = 0x44f5d0}}
        __for_begin = std::unique_ptr<SMonitor> = {get() = 0x44f5d0}
        __for_end = std::unique_ptr<SMonitor> = {get() = 0x0}
#3  0x00000000004101b9 in main (argc=2, argv=0x7fffffffdbe8, envp=0x7fffffffdc00)
    at /home/tim/prog/hyprpicker/src/main.cpp:64

... but you may be hitting a different bug.

utherpally commented 6 months ago

I am encountering similar difficulties on NixOS too.

backtrace warning: Can't open file /memfd:wayland-cursor (deleted) during file-backed mapping note processing [New LWP 43263] [Thread debugging using libthread_db enabled] Using host libthread_db library "/nix/store/cyrrf49i2hm1w7vn2j945ic3rrzgxbqs-glibc-2.38-44/lib/libthread_db.so.1". Core was generated by `hyprpicker'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000408b63 in CHyprpicker::recheckACK() () (gdb) bt full #0 0x0000000000408b63 in CHyprpicker::recheckACK() () No symbol table info available. #1 0x00007fc2fbd05052 in ffi_call_unix64 () from /nix/store/zabxhfpsgkb9c4sb7fy50pn1l1kczzv2-libffi-3.4.4/lib/libffi.so.8 No symbol table info available. #2 0x00007fc2fbd02ec5 in ffi_call_int () from /nix/store/zabxhfpsgkb9c4sb7fy50pn1l1kczzv2-libffi-3.4.4/lib/libffi.so.8 No symbol table info available. #3 0x00007fc2fbd03ab8 in ffi_call () from /nix/store/zabxhfpsgkb9c4sb7fy50pn1l1kczzv2-libffi-3.4.4/lib/libffi.so.8 No symbol table info available. #4 0x00007fc2fc3bd7a1 in wl_closure_invoke () from /nix/store/56nk74wwpamnnwpg89vwp22kwjw5lswd-wayland-1.22.0/lib/libwayland-client.so.0 No symbol table info available. #5 0x00007fc2fc3b9bd9 in dispatch_event.isra () from /nix/store/56nk74wwpamnnwpg89vwp22kwjw5lswd-wayland-1.22.0/lib/libwayland-client.so.0 No symbol table info available. #6 0x00007fc2fc3bb524 in wl_display_dispatch_queue_pending () from /nix/store/56nk74wwpamnnwpg89vwp22kwjw5lswd-wayland-1.22.0/lib/libwayland-client.so.0 No symbol table info available. #7 0x0000000000406c91 in CHyprpicker::init() () No symbol table info available. #8 0x0000000000403bf1 in main () No symbol table info available. (gdb) quit
deviantsemicolon commented 6 months ago

I'm also having issues on NixOS

Burn-E99 commented 6 months ago

I'm experiencing the same issue on EndeavourOS+KDE.

Full System Info ``` Operating System: EndeavourOS KDE Plasma Version: 5.27.10 KDE Frameworks Version: 5.115.0 Qt Version: 5.15.12 Kernel Version: 6.7.4-arch1-1 (64-bit) Graphics Platform: Wayland Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor Memory: 31.3 GiB of RAM Graphics Processor: AMD Radeon RX 7900 XTX Manufacturer: Gigabyte Technology Co., Ltd. Product Name: X570 AORUS ULTRA System Version: -CF ```
Full Backtrace ``` (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/eanmi/repos/hyprpicker/build/hyprpicker [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. wl_proxy_get_version (proxy=0x0) at ../wayland-1.22.0/src/wayland-client.c:2248 2248 return proxy->version; (gdb) bt full #0 wl_proxy_get_version (proxy=0x0) at ../wayland-1.22.0/src/wayland-client.c:2248 #1 0x000000000040eabc in zwlr_screencopy_manager_v1_capture_output (zwlr_screencopy_manager_v1=0x0, overlay_cursor=0, output=0x45ceb0) at /home/eanmi/repos/hyprpicker/./wlr-screencopy-unstable-v1-protocol.h:170 frame = 0x45c4e0 #2 0x000000000040c20f in CHyprpicker::init (this=0x456640) at /home/eanmi/repos/hyprpicker/src/hyprpicker.cpp:41 m = std::unique_ptr = {get() = 0x45ce50} __for_range = std::vector of length 4, capacity 4 = {std::unique_ptr = {get() = 0x45ce50}, std::unique_ptr = {get() = 0x45cfb0}, std::unique_ptr = {get() = 0x45d010}, std::unique_ptr = {get() = 0x45c400}} __for_begin = std::unique_ptr = {get() = 0x45ce50} __for_end = std::unique_ptr = {get() = 0x9} #3 0x00000000004105fd in main (argc=1, argv=0x7fffffffe168, envp=0x7fffffffe178) at /home/eanmi/repos/hyprpicker/src/main.cpp:64 (gdb) ```

It looks like I am getting the same error as @linuxtim. From my rudimentary debugging, it appears that the root issue is that m_pSCMgr is not defined, which I believe indicates the compositor doesn't support the wlr_screencopy_unstable_v1 protocol. If I'm understanding this all correctly, this (sadly) indicates its not an issue with hyprpicker and instead an issue with our systems.

Edit: Formatting fix, plus I just found the wlr_screencopy_unstable_v1 compositor support list, which lines up with my original results from debugging.

vaxerski commented 6 months ago

hyprpicker is not officially supported outside of hyprland, and will not work on kde/gnome due to the missing protocols.

SetOfAllSets commented 6 months ago
set@Gentoo ~ $ echo $XCURSOR_THEME

set@Gentoo ~ $ cd hyprpicker/
set@Gentoo ~/hyprpicker $ gdb ./build/hyprpicker 
GNU gdb (Gentoo 13.2 vanilla) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/hyprpicker...
(gdb) run
Starting program: /home/set/hyprpicker/build/hyprpicker 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x000000000040c64a in CHyprpicker::recheckACK (this=0x456440) at /home/set/hyprpicker/src/hyprpicker.cpp:83
83                 ls->pCursorImg = wl_cursor_theme_get_cursor(wl_cursor_theme_load(getenv("XCURSOR_THEME"), XCURSOR_SIZE * ls->m_pMonitor->scale, m_pWLSHM), "crosshair")->images[0];
(gdb) quit
A debugging session is active.

    Inferior 1 [process 11145] will be killed.

Quit anyway? (y or n) y

Could it have something to do with the fact I do not have XCURSOR_THEME set?

SetOfAllSets commented 6 months ago

Setting XCURSOR_THEME to Adwaita (which I have installed) fixed the issue and caused the program to behave as expected. Perhaps error handling for invalid or nonexistant values of XCURSOR_THEME is in order?

Keshav13142 commented 5 months ago

Setting XCURSOR_THEME to Adwaita (which I have installed) fixed the issue and caused the program to behave as expected. Perhaps error handling for invalid or nonexistant values of XCURSOR_THEME is in order?

Yup this was the fix for me as well. Thanks. For anyone using home manager, this is how I did it (put it inside your home configuration block):

pointerCursor = {
  gtk.enable = true;
  package = pkgs.gnome.adwaita-icon-theme;
  name = "Adwaita";
  size = 16;
};
vaxerski commented 5 months ago

check above