bug-guile-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Build fails but has an easy fix [6.10.2-arch1-1]


From: Caleb E
Subject: Build fails but has an easy fix [6.10.2-arch1-1]
Date: Fri, 2 Aug 2024 22:31:23 -0500
User-agent: Mozilla Thunderbird

Hello Guile NCurses mailing list,

I just wanted to submit this bug report or ask what is wrong with my config if it isn't a bug. When building guile-ncurses from master and from the v3.1 tar (on 6.10.2-arch1-1 at least), it fails to build menu_type.c with the error

menu_type.c: In function 'gc_free_menu':
menu_type.c:321:25: error: invalid use of incomplete typedef 'ITEM' {aka 'struct tagITEM'}
  321 |           pitem_store[i]->left = NULL;
      |                         ^~

which is repeated for ->right, ->up, and ->down on the next 3 lines respectively. ITEM and struct tagITEM are defined in <menu.h> for me (provided by core/ncurses on Arch which is currently version 6.5.20240427) and are somehow becoming opaque to menu_type.c. I've tried defining NCURSES_OPAQUE_MENU=0 at various different points in the compilation (from ./configure all the way down to the generated Makefile in src/ncurses) and it still has the incomplete typedef error. The solution I found, which I've included as a patch diff at the end of this message, is to copy the definition of ITEM into menu_type.h. I imagine this is not very portable but I still wanted to provide the patch as an indication that it is in fact erroring because ITEM from <menu.h> is opaque. After patching it builds, installs, and runs as expected. Because the comment in menu_type.c:313-318 explains that this is not typical NCurses behavior, I was not able to find a "proper" way to fix this other than the copied definition as there are no public methods that I could find to access the neighbor items. Even though I just ran `./bootstrap && ./configure`, let me know if there are any logs that would be helpful to send in case it is my package configuration causing this.

diff --git a/src/ncurses/menu_type.h b/src/ncurses/menu_type.h
index 320fd6a..3f1b274 100644
--- a/src/ncurses/menu_type.h
+++ b/src/ncurses/menu_type.h
@@ -36,6 +36,35 @@
 #error "No menu.h file included"
 #endif

+typedef struct
+{
+  const char *str;
+  unsigned short length;
+}
+TEXT;
+
+struct tagMENU;
+
+typedef struct tagITEM
+{
+  TEXT name;        /* name of menu item                         */
+  TEXT description;        /* description of item, optional in display  */
+  struct tagMENU *imenu;    /* Pointer to parent menu                    */
+  void *userptr;        /* Pointer to user defined per item data     */
+  Item_Options opt;        /* Item options                              */
+  short index;        /* Item number if connected to a menu        */
+  short y;            /* y and x location of item in menu          */
+  short x;
+  bool value;        /* Selection value                           */
+
+  struct tagITEM *left;    /* neighbor items                            */
+  struct tagITEM *right;
+  struct tagITEM *up;
+  struct tagITEM *down;
+
+}
+ITEM;
+
 GUCU_LOCAL int _scm_is_item (SCM x);
 GUCU_LOCAL ITEM *_scm_to_item (SCM x);
 GUCU_LOCAL SCM _scm_from_item (ITEM *x);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]