htop icon indicating copy to clipboard operation
htop copied to clipboard

htop fails to compile with gcc-14.1 unless ncurses has been built with --enable-sigwinch

Open heitbaum opened this issue 1 year ago • 1 comments

The below line causes a failure to compile htop with gcc-14.1 when ncurses has not been built with --enable-sigwinch. https://github.com/htop-dev/htop/blob/4b3dfa246e9fa0fe3ce7d97e7a37239251ada42b/ScreenManager.c#L361-L365

../ScreenManager.c: In function 'ScreenManager_run':
../ScreenManager.c:361:12: error: 'KEY_RESIZE' undeclared (first use in this function); did you mean 'KEY_RESUME'?
  361 |       case KEY_RESIZE:
      |            ^~~~~~~~~~
      |            KEY_RESUME
../ScreenManager.c:361:12: note: each undeclared identifier is reported only once for each function it appears in

Ref:

/*
 * KEY_RESIZE is an extended feature that relies upon the SIGWINCH handler
 * in ncurses.
 */
#if 1
#ifndef NCURSES_SIGWINCH
#define NCURSES_SIGWINCH 1
#endif
#else
#undef NCURSES_SIGWINCH
#define NCURSES_SIGWINCH 0
#endif

...

#if NCURSES_SIGWINCH
#define KEY_RESIZE      0632            /* Terminal resize event */
#endif

heitbaum avatar May 07 '24 06:05 heitbaum

hm, we could #ifdef that. And we could write our own signal handler for sigwinch in case ncurses has been compiled without its own. Or we gracefully complain and exit at the configure stage.

fasterit avatar May 07 '24 12:05 fasterit

@fasterit Does this issue still happen with the current main? I noticed #1475 has been closed because of ProvideCurses.h dependency on config.h or something like that, but as I made the commit a2d90f4d19f11f5e96ef9faf5f50d51a5c260c73 that fixed that config.h thing, maybe the configure check on KEY_RESIZE can be revisited again and #1475 rebased onto the current main.

Explorer09 avatar Dec 27 '24 18:12 Explorer09

What's the status for this? Any PR addressing this?

BenBE avatar Feb 12 '25 20:02 BenBE

I think this is sufficiently covered with the configure check from #1475. Closing. Please feel free to re-open if you think differently.

fasterit avatar Feb 20 '25 10:02 fasterit