Bug#1057553: dosbox: FTBFS: error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}

2023-12-06 Thread Sven Joachim
Control: tags -1 + trixie sid patch

On 2023-12-05 23:04 +0100, Santiago Vila wrote:

> Package: src:dosbox
> Version: 0.74-3-4
> Severity: serious
> Tags: ftbfs
>
> During a rebuild of all packages in unstable, your package failed to build:
> In file included from ../../../src/debug/debug_gui.cpp:28:
> ../../../src/debug/debug_gui.cpp: In function ‘void DrawBars()’:
> ../../../src/debug/debug_gui.cpp:149:29: error: invalid use of incomplete 
> type ‘WINDOW’ {aka ‘struct _win_st’}
>   149 | mvaddstr(dbg.win_reg->_begy-1,0, "---(Register Overview   
> )---");
>   | ^~
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>   |^~~
> ../../../src/debug/debug_gui.cpp:151:30: error: invalid use of incomplete 
> type ‘WINDOW’ {aka ‘struct _win_st’}
>   151 | mvaddstr(dbg.win_data->_begy-1,0,"---(Data Overview   Scroll: 
> page up/down)---");
>   |  ^~
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>   |^~~
> ../../../src/debug/debug_gui.cpp:153:30: error: invalid use of incomplete 
> type ‘WINDOW’ {aka ‘struct _win_st’}
>   153 | mvaddstr(dbg.win_code->_begy-1,0,"---(Code Overview   Scroll: 
> up/down )---");
>   |  ^~
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>   |^~~
> ../../../src/debug/debug_gui.cpp:155:29: error: invalid use of incomplete 
> type ‘WINDOW’ {aka ‘struct _win_st’}
>   155 | mvaddstr(dbg.win_var->_begy-1,0, "---(Variable Overview   
> )---");
>   | ^~
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>   |^~~
> ../../../src/debug/debug_gui.cpp:157:29: error: invalid use of incomplete 
> type ‘WINDOW’ {aka ‘struct _win_st’}
>   157 | mvaddstr(dbg.win_out->_begy-1,0, "---(OutPut/InputScroll: 
> home/end)---");
>   | ^~
> /usr/include/curses.h:442:16: note: forward declaration of ‘WINDOW’ {aka 
> ‘struct _win_st’}
>   442 | typedef struct _win_st WINDOW;
>   |^~~
> make[5]: *** [Makefile:358: debug_gui.o] Error 1

I have left out the gazillion of string format warnings, the above
messages are the only actual errors making the build fail.

They have been caused by a recent change in ncurses which makes the
WINDOW structure opaque.  Accessing its members directly is no longer
possible, you need to use library functions to obtain window dimensions
and positions.  In the current case, this would be getbegy(), see the
attached patch.  I have only tested that it builds, though,

See the ncurses INSTALL file:

,
| --enable-opaque-curses
| --enable-opaque-form
| --enable-opaque-menu
| --enable-opaque-panel
|   Define symbol in curses.h controlling whether some library structures
|   are opaque, meaning that their members are accessible only via the
|   documented API.  The --enable-opaque-curses option may be overridden
|   by the --enable-reentrant option.
| 
|   Enabling opaque-curses enables opaque for the form, menu, and panel
|   libraries.  Use their corresponding options to disable the feature
|   individually.
| 
|   NOTE: beginning with ncurses 6.5 this option is enabled by default;
|   older versions disable it by default.
`

While ncurses 6.5 has not been released yet, the change has already been
made in the patchlevel Debian is shipping.  From the NEWS file:

,
| 20231021
|   + change defaults for configure opaque and widec options (prompted by
| discussion with Branden Robinson).
`

Cheers,
   Sven (ncurses maintainer in Debian)

From ab9fe80d94d35d10109ee4899de7b37eeab474eb Mon Sep 17 00:00:00 2001
From: Sven Joachim 
Date: Wed, 6 Dec 2023 17:49:05 +0100
Subject: [PATCH] Use getbegy() rather than accessing window structures
 directly

---
 src/debug/debug_gui.cpp | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/debug/debug_gui.cpp b/src/debug/debug_gui.cpp
index fc9f1ca..53743e3 100644
--- a/src/debug/debug_gui.cpp
+++ b/src/debug/debug_gui.cpp
@@ -146,15 +146,15 @@ static void DrawBars(void) {
 		attrset(COLOR_PAIR(PAIR_BLACK_BLUE));
 	}
 	/* Show the Register bar */
-	mvaddstr(dbg.win_reg->_begy-1,0, "---(Register Overview   )---");
+	mvaddstr(getbegy(dbg.win_reg)-1,0, "---(Register Overview   )---");
 	/* Show the Data Overview bar perhaps with more special stuff in the end */
-	mvaddstr(dbg.win_data->_begy-1,0,"---(Data Overview   

Bug#1057553: dosbox: FTBFS: error: invalid use of incomplete type ‘WINDOW’ {aka ‘struct _win_st’}

2023-12-05 Thread Santiago Vila

Package: src:dosbox
Version: 0.74-3-4
Severity: serious
Tags: ftbfs

Dear maintainer:

During a rebuild of all packages in unstable, your package failed to build:


[...]
 debian/rules binary
dh binary
   dh_update_autotools_config
   dh_autoreconf
configure.ac:12: warning: The macro `AC_CONFIG_HEADER' is obsolete.
configure.ac:12: You should run autoupdate.
./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.ac:12: the top level
configure.ac:31: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:31: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
acinclude.m4:4: AM_PATH_SDL is expanded from...
configure.ac:31: the top level
configure.ac:31: warning: The macro `AC_TRY_LINK' is obsolete.

[... snipped ...]

../../../src/cpu/core_dynrec/dyn_fpu.h:354:86: warning: format ‘%d’ expects 
argument of type ‘int’, but argument 4 has type ‘Bitu’ {aka ‘long unsigned 
int’} [-Wformat=]
  354 | LOG(LOG_FPU,LOG_WARN)("ESC 2:Unhandled group %d 
subfunction %d",decode.modrm.reg,decode.modrm.rm);
  | 
~^   ~~~
  | 
 ||
  | 
 int  Bitu {aka long unsigned int}
  | 
%ld
../../../src/cpu/core_dynrec/dyn_fpu.h: In function ‘void dyn_fpu_esc3()’:
../../../src/cpu/core_dynrec/dyn_fpu.h:373:110: warning: format ‘%d’ expects 
argument of type ‘int’, but argument 3 has type ‘Bitu’ {aka ‘long unsigned 
int’} [-Wformat=]
  373 | LOG(LOG_FPU,LOG_ERROR)("8087 only fpu code 
used esc 3: group 4: subfuntion: %d",decode.modrm.rm);
  | 
~^  ~~~
  | 
 |   |
  | 
 int Bitu {aka long unsigned 
int}
  | 
%ld
../../../src/cpu/core_dynrec/dyn_fpu.h:386:69: warning: format ‘%d’ expects 
argument of type ‘int’, but argument 2 has type ‘Bitu’ {aka ‘long unsigned 
int’} [-Wformat=]
  386 | E_Exit("ESC 3:ILLEGAL OPCODE group %d 
subfunction %d",decode.modrm.reg,decode.modrm.rm);
  |~^   
  
  | |   
   |
  | int 
   Bitu {aka long unsigned int}
  |%ld
../../../src/cpu/core_dynrec/dyn_fpu.h:386:84: warning: format ‘%d’ expects 
argument of type ‘int’, but argument 3 has type ‘Bitu’ {aka ‘long unsigned 
int’} [-Wformat=]
  386 | E_Exit("ESC 3:ILLEGAL OPCODE group %d 
subfunction %d",decode.modrm.reg,decode.modrm.rm);
  | 
  ~^   ~~~
  | 
   ||
  | 
   int  Bitu {aka long unsigned int}
  | 
  %ld
../../../src/cpu/core_dynrec/dyn_fpu.h:390:71: warning: format ‘%d’ expects 
argument of type ‘int’, but argument 3 has type ‘Bitu’ {aka ‘long unsigned 
int’} [-Wformat=]
  390 | LOG(LOG_FPU,LOG_WARN)("ESC 3:Unhandled group %d 
subfunction %d",decode.modrm.reg,decode.modrm.rm);
  |  ~^ 

  |   | 
 |
  |   
intBitu {aka long unsigned int}
  |  %ld
../../../src/cpu/core_dynrec/dyn_fpu.h:390:86: warning: format ‘%d’ expects