Bug 30391 - [gdb/build] COLS/LINES reference from maint info screen breaks build
Summary: [gdb/build] COLS/LINES reference from maint info screen breaks build
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 14.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-26 16:46 UTC by Tom de Vries
Modified: 2023-04-29 05:05 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Tentative patch (869 bytes, patch)
2023-04-28 06:08 UTC, Tom de Vries
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2023-04-26 16:46:35 UTC
I received the following bug report:
...
make[2]: Entering directory '/home/Work/binutils-gdb/build/gdb'
  CXX    utils.o
../../gdb/utils.c: In function ‘void maintenance_info_screen(const char*, int)’:
../../gdb/utils.c:1310:14: error: ‘COLS’ was not declared in this scope
 1310 |              COLS);
      |              ^~~~
../../gdb/utils.c:1331:15: error: ‘LINES’ was not declared in this scope; did you mean ‘LONGEST’?
 1331 |               LINES);
      |               ^~~~~
      |               LONGEST
make[2]: *** [Makefile:1920: utils.o] Error 1
make[2]: Leaving directory '/home/Work/binutils-gdb/build/gdb'
make[1]: *** [Makefile:14587: all-gdb] Error 2
make[1]: Leaving directory '/home/Work/binutils-gdb/build'
make: *** [Makefile:1009: all] Error 2
...
filed here ( https://github.com/bminor/binutils-gdb/commit/f1531d046178fbdd97e3440e3d454683440b75f9#r110673657 ).

I haven't been reproduce it yet, so I'm not sure what a fix would be.

I tried building without tui but _nc_LINES is resolved by /lib64/libtinfo.so.6.
Comment 1 Tom de Vries 2023-04-27 07:50:11 UTC
Not sure how to reproduce this yet, but I suppose a simple #ifdef COLS/LINES will fix this.
Comment 2 Tom de Vries 2023-04-28 05:51:34 UTC
(In reply to Tom de Vries from comment #1)
> Not sure how to reproduce this yet, but I suppose a simple #ifdef COLS/LINES
> will fix this.

Reproduced, by:
- de-installing package ncurses-devel (which for me also de-installs
  readline-devel and guile-devel), and
- building with --disable-tui (such that we don't require ncurses) and
  --without-system-readline (such that we don't require readline).
Comment 3 Tom de Vries 2023-04-28 05:52:42 UTC
(In reply to Tom de Vries from comment #2)
> - de-installing package ncurses-devel

Suggested here: https://sourceware.org/pipermail/gdb-patches/2023-April/199152.html
Comment 4 Tom de Vries 2023-04-28 06:08:13 UTC
Created attachment 14854 [details]
Tentative patch

Tentative patch, using HAVE_LIBCURSES.
Comment 5 Sourceware Commits 2023-04-29 05:04:17 UTC
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e5cbbbf79ad269983f744414a7efece6784dd682

commit e5cbbbf79ad269983f744414a7efece6784dd682
Author: Tom de Vries <tdevries@suse.de>
Date:   Sat Apr 29 07:04:27 2023 +0200

    [gdb/build] Fix build without ncurses in maintenance_info_screen
    
    With a build without ncurses we run into:
    ...
    src/gdb/utils.c: In function âvoid maintenance_info_screen(const char*, int)â:
    src/gdb/utils.c:1310:7: error: âCOLSâ was not declared in this scope
           COLS);
           ^~~~
    src/gdb/utils.c:1331:8: error: âLINESâ was not declared in this scope
            LINES);
            ^~~~~
    ...
    
    Fix this by using HAVE_LIBCURSES.
    
    Tested on x86_64-linux.
    
    PR build/30391
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30391
Comment 6 Tom de Vries 2023-04-29 05:05:56 UTC
Fixed.