hyprpicker icon indicating copy to clipboard operation
hyprpicker copied to clipboard

Segmentation fault (core dumped)

Open svelterust opened this issue 1 year ago • 12 comments

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

svelterust avatar Nov 27 '23 09:11 svelterust

try -git, it had some safety improvements.

vaxerski avatar Nov 27 '23 10:11 vaxerski

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.

ckx avatar Dec 13 '23 01:12 ckx

I am having the same issue in NixOS as well.

Gxnum avatar Feb 09 '24 17:02 Gxnum

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.

linuxtim avatar Feb 14 '24 10:02 linuxtim

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

utherpally avatar Feb 16 '24 14:02 utherpally

I'm also having issues on NixOS

deviantsemicolon avatar Feb 19 '24 05:02 deviantsemicolon

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<SMonitor> = {get() = 0x45ce50}
        __for_range = std::vector of length 4, capacity 4 = {std::unique_ptr<SMonitor> = {get() = 0x45ce50}, std::unique_ptr<SMonitor> = {get() = 0x45cfb0}, std::unique_ptr<SMonitor> = {get() = 0x45d010}, std::unique_ptr<SMonitor> = {get() = 0x45c400}}
        __for_begin = std::unique_ptr<SMonitor> = {get() = 0x45ce50}
        __for_end = std::unique_ptr<SMonitor> = {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.

Burn-E99 avatar Feb 19 '24 11:02 Burn-E99

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

vaxerski avatar Feb 19 '24 11:02 vaxerski

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 avatar Feb 26 '24 23:02 SetOfAllSets

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?

SetOfAllSets avatar Feb 27 '24 00:02 SetOfAllSets

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;
};

Keshav13142 avatar Mar 23 '24 06:03 Keshav13142

check above

vaxerski avatar Mar 23 '24 20:03 vaxerski