Playing something on the terminal with `mpv -vo caca` segfaults: Thread 5 "mpv/vo" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffedb5a640 (LWP 239402)] 0x00007ffff57fa977 in _nc_setupscreen_sp (spp=spp@entry=0x7fffedb595d8, slines=<optimized out>, scolumns=<optimized out>, output=output@entry=0x7ffff59cf520 <_IO_2_1_stdout_>, filtered=<optimized out>, slk_format=slk_format@entry=0) at /var/tmp/portage/sys-libs/ncurses-6.3_p20211106/work/ncurses-6.3/ncurses/base/lib_set_term.c:505 505 /var/tmp/portage/sys-libs/ncurses-6.3_p20211106/work/ncurses-6.3/ncurses/base/lib_set_term.c: No such file or directory. #0 0x00007ffff57fa977 in _nc_setupscreen_sp (spp=spp@entry=0x7fffedb595d8, slines=<optimized out>, scolumns=<optimized out>, output=output@entry=0x7ffff59cf520 <_IO_2_1_stdout_>, filtered=<optimized out>, slk_format=slk_format@entry=0) at /var/tmp/portage/sys-libs/ncurses-6.3_p20211106/work/ncurses-6.3/ncurses/base/lib_set_term.c:505 #1 0x00007ffff57f60bc in newterm_sp (sp=<optimized out>, name=name@entry=0x7fffe4002860 "screen.xterm-256color", ofp=ofp@entry=0x7ffff59cf520 <_IO_2_1_stdout_>, ifp=ifp@entry=0x7ffff59ce800 <_IO_2_1_stdin_>) at /var/tmp/portage/sys-libs/ncurses-6.3_p20211106/work/ncurses-6.3/ncurses/base/lib_newterm.c:234 #2 0x00007ffff57f6569 in newterm (name=name@entry=0x7fffe4002860 "screen.xterm-256color", ofp=0x7ffff59cf520 <_IO_2_1_stdout_>, ifp=0x7ffff59ce800 <_IO_2_1_stdin_>) at /var/tmp/portage/sys-libs/ncurses-6.3_p20211106/work/ncurses-6.3/ncurses/base/lib_newterm.c:367 #3 0x00007ffff57f1f90 in initscr () at /var/tmp/portage/sys-libs/ncurses-6.3_p20211106/work/ncurses-6.3/ncurses/base/lib_initscr.c:93 #4 0x00007ffff7dfdf3d in ncurses_init_graphics (dp=0x7fffe4000cb0) at /var/tmp/portage/media-libs/libcaca-0.99_beta19-r8/work/libcaca-0.99.beta19/caca/driver/ncurses.c:251 #5 0x00007ffff7dec2d6 in caca_install_driver (dp=dp@entry=0x7fffe4000cb0, driver=driver@entry=0x0) at /var/tmp/portage/media-libs/libcaca-0.99_beta19-r8/work/libcaca-0.99.beta19/caca/caca.c:301 #6 0x00007ffff7dec45e in caca_create_display_with_driver (cv=0x7fffe4000b60, driver=driver@entry=0x0) at /var/tmp/portage/media-libs/libcaca-0.99_beta19-r8/work/libcaca-0.99.beta19/caca/caca.c:125 #7 0x00007ffff7dec537 in caca_create_display (cv=<optimized out>) at /var/tmp/portage/media-libs/libcaca-0.99_beta19-r8/work/libcaca-0.99.beta19/caca/caca.c:70 #8 0x0000555555670064 in preinit (vo=0x55555573b650) at ../video/out/vo_caca.c:271 #9 0x000055555566eade in vo_thread (ptr=0x55555573b650) at ../video/out/vo.c:1080 #10 0x00007ffff7c16cfe in start_thread (arg=0x7fffedb5a640) at pthread_create.c:481 #11 0x00007ffff591155f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 I suppose this is similar to bugs like #669096 #692954 #729362 #654866 (and possibly others) which are caused by some incompatible combination of lib(n?curses|tinfo)w? getting linked in. Having LD_PRELOAD=libncursesw.so.6 in the environment seems to be a workaround.
mpv itself doesn't link with ncurses, in fact the only thing using ncurses in the build I reproduced this on is libcaca.. and it's already ncursesw? $ lddtree /usr/bin/mpv | grep ncurses -B 1 libcaca.so.0 => /usr/lib64/libcaca.so.0 libncursesw.so.6 => /lib64/libncursesw.so.6 And libcaca[slang,-ncurses] works just fine with mpv, same for non-console backends like X So I had a look at the libcaca ebuild and there's this linking the non-w variant (even tries to with USE=-ncurses!) # bug #601902 append-libs "$($(tc-getPKG_CONFIG) --libs ncurses)" Then it gets discarded by -Wl,--as-needed but probably messes up something in the process because it works just fine if I remove the line. Also, it doesn't seem needed like bug #601902 mentions? -Wl,--as-needed discards tinfo as well, but if want to play it safe guess could replaced by --libs tinfow. I'll do that given I don't particularly want to look into libcaca much.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35683548ca97455f295f52aed45cdf357b878794 commit 35683548ca97455f295f52aed45cdf357b878794 Author: Ionen Wolkens <ionen@gentoo.org> AuthorDate: 2022-11-07 21:04:40 +0000 Commit: Ionen Wolkens <ionen@gentoo.org> CommitDate: 2022-11-07 21:08:46 +0000 media-libs/libcaca: avoid mixing ncurses with ncursesw Also only do this with USE=ncurses and use || die (fixes runtime with mpv wrt bug #825058) Closes: https://bugs.gentoo.org/825058 Signed-off-by: Ionen Wolkens <ionen@gentoo.org> ...{libcaca-0.99_beta19-r10.ebuild => libcaca-0.99_beta19-r11.ebuild} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)