chaotic-cx / nyx

Nix flake for "too much bleeding-edge" and unreleased packages (e.g., mesa_git, linux_cachyos, firefox_nightly, sway_git, gamescope_git). And experimental modules (e.g., HDR, duckdns).
https://nyx.chaotic.cx
MIT License
365 stars 37 forks source link

[Bug] readline build failure #732

Open silvanshade opened 6 months ago

silvanshade commented 6 months ago

What happens?

When trying to build the linuxPackages_cachyos kernel for znver4, the readline package fails to build.

What is expected to happen?

Build should succeed.

If possible, please attach logs

gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare readline.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare vi_mode.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare funmap.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare keymaps.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare parens.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare search.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare rltty.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare complete.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare bind.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare isearch.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare display.c
display.c: In function ‘_rl_move_cursor_relative’:
display.c:2839:17: warning: implicit declaration of function ‘tputs’; did you mean ‘puts’? [-Wimplicit-function-declaration]
 2839 |                 tputs (_rl_term_forward_char, 1, _rl_output_character_function);
      |                 ^~~~~
      |                 puts
display.c: In function ‘open_some_spaces’:
display.c:3255:16: warning: implicit declaration of function ‘tgoto’ [-Wimplicit-function-declaration]
 3255 |       buffer = tgoto (_rl_term_IC, 0, col);
      |                ^~~~~
display.c:3255:14: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 3255 |       buffer = tgoto (_rl_term_IC, 0, col);
      |              ^
display.c: In function ‘delete_chars’:
display.c:3291:14: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 3291 |       buffer = tgoto (_rl_term_DC, count, count);
      |              ^
At top level:
cc1: note: unrecognized command-line option ‘-Wno-tautological-constant-out-of-range-compare’ may have been intended to silence earlier diagnostics
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare signals.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare util.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare kill.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare undo.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare macro.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare input.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare callback.c
gcc -c  -DHAVE_CONFIG_H   -I. -I.  -DRL_LIBRARY_VERSION='"8.2"' -DBRACKETED_PASTE_DEFAULT=1 -g -O2 -Wno-parentheses -Wno-format-security -Wno-tautological-constant-out-of-range-compare terminal.c
terminal.c: In function ‘_rl_get_screen_size’:
terminal.c:303:27: warning: implicit declaration of function ‘tgetnum’ [-Wimplicit-function-declaration]
  303 |         _rl_screenwidth = tgetnum ("co");
      |                           ^~~~~~~
terminal.c: In function ‘get_term_capabilities’:
terminal.c:464:33: warning: implicit declaration of function ‘tgetstr’ [-Wimplicit-function-declaration]
  464 |     *(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
      |                                 ^~~~~~~
terminal.c:464:31: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  464 |     *(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
      |                               ^
terminal.c: In function ‘_rl_init_terminal_io’:
terminal.c:523:21: warning: implicit declaration of function ‘tgetent’; did you mean ‘getenv’? [-Wimplicit-function-declaration]
  523 |       tgetent_ret = tgetent (term_buffer, term);
      |                     ^~~~~~~
      |                     getenv
terminal.c:580:7: error: ‘PC’ undeclared (first use in this function)
  580 |       PC = '\0';
      |       ^~
terminal.c:580:7: note: each undeclared identifier is reported only once for each function it appears in
terminal.c:581:7: error: ‘BC’ undeclared (first use in this function); did you mean ‘B0’?
  581 |       BC = _rl_term_backspace = "\b";
      |       ^~
      |       B0
terminal.c:582:7: error: ‘UP’ undeclared (first use in this function)
  582 |       UP = _rl_term_up;
      |       ^~
terminal.c:204:26: warning: implicit declaration of function ‘tgetflag’ [-Wimplicit-function-declaration]
  204 | #define TGETFLAG(cap)   (tgetflag (cap) == TGETFLAG_SUCCESS)
      |                          ^~~~~~~~
terminal.c:598:23: note: in expansion of macro ‘TGETFLAG’
  598 |   _rl_term_autowrap = TGETFLAG ("am") && TGETFLAG ("xn");
      |                       ^~~~~~~~
terminal.c: In function ‘_rl_backspace’:
terminal.c:724:7: warning: implicit declaration of function ‘tputs’; did you mean ‘puts’? [-Wimplicit-function-declaration]
  724 |       tputs (_rl_term_backspace, 1, _rl_output_character_function);
      |       ^~~~~
      |       puts
At top level:
cc1: note: unrecognized command-line option ‘-Wno-tautological-constant-out-of-range-compare’ may have been intended to silence earlier diagnostics
make: *** [Makefile:105: terminal.o] Error 1

More information

If you look up the error in the log, the issue is in the tcap.h file, specifically this part:

#if defined(HAVE_TERMCAP_H)
#if defined(__linux__) && !defined(SPEED_T_IN_SYS_TYPES)
#include "rltty.h"
#endif
#include <termcap.h>
#elif defined(HAVE_NCURSES_TERMCAP_H)
#include <ncurses/termcap.h>
#else

/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC.
   Unfortunately, PC is a global variable used by the termcap library. */
#ifdef PC
#undef PC
#endif

extern char PC;
extern char *UP, *BC;

If you comment out this part:

// #if defined(HAVE_TERMCAP_H)
// #if defined(__linux__) && !defined(SPEED_T_IN_SYS_TYPES)
// #include "rltty.h"
// #endif
// #include <termcap.h>
// #elif defined(HAVE_NCURSES_TERMCAP_H)
// #include <ncurses/termcap.h>
// #else

/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC.
   Unfortunately, PC is a global variable used by the termcap library. */
#ifdef PC
#undef PC
#endif

extern char PC;
extern char *UP, *BC;

extern short ospeed;

extern int tgetent();
extern int tgetflag();
extern int tgetnum();
extern char *tgetstr();

extern int tputs();

extern char *tgoto();

// #endif /* HAVE_TERMCAP_H */

The compilation continues but ultimately linking fails with an error saying -lncurses not found.

So somehow the configuration for readline is incorrect.

I'm not sure why this happens though because if I try to build readline separately with nix-shell -p readline it works (even with those modified CFLAGS for znver4, although as you can see from the logs they shouldn't affect the build here anyway).

Any idea what could be causing this?

PedroHLC commented 6 months ago

Any idea what could be causing this?

Nope, and sorry, besides not having a v4, this issue would take too much time to replicate. By your diagnostic, I would guess the issue is in some of the readline's dependencies. @ptr1337 as a v4 worshiper might have a better guess.