FS#55923 - [ncurses] Build with gpm support
Attached to Project:
Arch Linux
Opened by Alexandre Bury (gyscos) - Sunday, 08 October 2017, 22:17 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Friday, 01 June 2018, 10:26 GMT
Opened by Alexandre Bury (gyscos) - Sunday, 08 October 2017, 22:17 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Friday, 01 June 2018, 10:26 GMT
|
Details
From
https://bbs.archlinux.org/viewtopic.php?id=225660
GPM is a daemon used to provide mouse events to application running in the linux terminal. There are usually 2 ways to use gpm events in ncurses applications: * Directly use libgpm in parallel to ncurses events (this is what elinks does for instance) * Let ncurses deal with gpm internally When using ncurses, it's very convenient to let ncurses deal with gpm internally, and just process mouse events transparently. For that, ncurses needs to link to gpm. Modern version of ncurses do this dynamically: at runtime, they check if libgpm.so is available for loading. However, in the ncurses package from Arch's repositories, such loading fails. Indeed, in `ncurses/base/lib_mouse.c`, the function `load_gpm_library` tries to load the file behind the macro `LIBGPM_SONAME`. This macro variable evaluates to the string `maybe` instead of the correct `/lib/libgpm.so`, as can be seen in the generated `include/ncurses_cfg.h`. This file is built by the `configure` script, and where `LIBGPM_SONAME` is set to `$cf_cv_gpm_soname`, itself set from `with_gpm`, itself set to `maybe`. I'm not sure if the problem is with ncurses' configure script or with the set of parameters we use in the repository. Steps to reproduce: * Write a test program using ncurses and the mouse, for instance http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/mouse.html * Install ncurses and gpm; start the gpm service * Compile and run the example, either in a X session or in a virtual console. Notice no mouse support. |
This task depends upon
Closed by Bartłomiej Piotrowski (Barthalion)
Friday, 01 June 2018, 10:26 GMT
Reason for closing: Won't implement
Friday, 01 June 2018, 10:26 GMT
Reason for closing: Won't implement
Here is another simple C program testing ncurses events: https://gist.github.com/sylt/93d3f7b77e7f3a881603
It works in a terminal emulator (which doesn't need gpm anyway), but not in the virtual console.
With ncurses-6.0+20170902-3 installed from the repository (on x86_64), the example program does not return any mouse event in a virtual console.
But if I build the package myself from the PKGBUILD (`asp checkout ncurses`, at git-svn id 308920), then it works! It also results in a package 0.24MiB large.
Not sure what the difference is.
I ran `strace` on the test program, both with the official repository package, and with the locally built (I directly ran `asp checkout ncurses && cd ncurses/trunk && makepkg -si`):
Official repository package (failing GPM): https://pastebin.com/HGu7SsmN
Locally built package (working GPM): https://pastebin.com/GBFiRERv
It seems the working version loads `libdl.so.2`, which the official package does not even attempt. Maybe dynamic loading is disabled in the official build? (But then why is it enabled locally?...)
Not really relevant to the question of "should we enable this" anyway.