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
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

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
Comment by Alexandre Bury (gyscos) - Wednesday, 11 October 2017, 00:55 GMT
Note: I was wrong regarding the X session, the linked ncurses example code is just not working great.
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.
Comment by Alexandre Bury (gyscos) - Sunday, 05 November 2017, 19:14 GMT
Well, that's interesting.
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?...)
Comment by Eli Schwartz (eschwartz) - Monday, 06 November 2017, 06:31 GMT
This is not so uncommon, likely caused by https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies

Not really relevant to the question of "should we enable this" anyway.
Comment by Bartłomiej Piotrowski (Barthalion) - Friday, 01 June 2018, 09:46 GMT
It hasn't received any votes so far and as I don't use gpm myself, I don't think it makes sense to enable it.

Loading...