[PATCH] menuconfig: GCC failing saying ncurses is not found

Fiona Klute fiona.klute at gmx.de
Fri Jul 26 16:27:21 UTC 2024


Harald van Dijk wrote:
> On 21/07/2024 13:10, Nop wrote:
>> Newer GCC increased diagnostics levels resulting in considering the test
>> code to be invalid. The resulting message was misleading, saying that
>> ncurses is not found, while it is actually found because GCC output is
>> redirected to /dev/null.

I ran into the same problem, thanks for sending a patch already!

> Hi,
>
> This explanation does not look correct. GCC output being redirected has
> nothing to do with whether ncurses can or cannot be found, GCC output
> being redirected only means the reason why ncurses cannot be found gets
> hidden. In buildroot, the same error was fixed while keeping the
> 2>/dev/null:
>
> https://github.com/buildroot/buildroot/blob/a6210d28dbf66b2f0a42d945711dfd93c7329feb/support/kconfig/patches/22-kconfig-lxdialog-fix-check-with-GCC14.patch

The 2>/dev/null didn't *cause* the issue, but it *hid* the actual error,
making debugging harder. Fixing the current issue requires only the
second change in the patch (explicit return type), but I strongly agree
that the redirection should be removed to make finding any future issues
easier.

> In Linux, this problem was avoided because the check was changed to not
> do compilation of a test program at all (preferring pkg-config instead):
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch?id=1c5af5cf9308fff327f52c7efd2dfa732d370871

I wouldn't mind Busybox adopting the current Linux version with the in
my opinion much more convenient nconfig, but until/unless that happens
I'd like this patch to be merged so "make menuconfig" works on systems
with GCC >= 14.1. ;-)

Is there anything I can do to help make that happen? Maybe the slightly
rephrased commit message I've submitted to Buildroot with this patch is
enough already?
https://patchwork.ozlabs.org/project/buildroot/patch/20240726160152.2182074-1-fiona.klute@gmx.de/

Best regards,
Fiona

> Cheers,
> Harald van Dijk
>
>> Signed-off-by: ctxnop <ctxnop at gmail.com>
>> ---
>>   scripts/kconfig/lxdialog/check-lxdialog.sh | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh
>> b/scripts/kconfig/lxdialog/check-lxdialog.sh
>> index 5075ebf2d..c644d1d48 100755
>> --- a/scripts/kconfig/lxdialog/check-lxdialog.sh
>> +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
>> @@ -45,9 +45,9 @@ trap "rm -f $tmp" 0 1 2 3 15
>>
>>   # Check if we can link to ncurses
>>   check() {
>> -        $cc -x c - -o $tmp 2>/dev/null <<'EOF'
>> +        $cc -x c - -o $tmp <<'EOF'
>>   #include CURSES_LOC
>> -main() {}
>> +int main() { return 0; }
>>   EOF
>>      if [ $? != 0 ]; then
>>          echo " *** Unable to find the ncurses libraries or the"       1>&2
>> --
>> 2.45.2



More information about the busybox mailing list