Ticket #4200 (closed defect: fixed)
If wchar is not included in ncurses, mc 4.8.26 fails to compile.
Reported by: | mrbump | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 4.8.28 |
Component: | mc-tty | Version: | 4.8.26 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master |
Description
With the introduction of shadows in mc (which are nice) on platforms that support them with the following commit - https://github.com/MidnightCommander/mc/commit/8b4386df83ab5a525f0568113fe1e53d362f433e.patch and Ticket #4120: draw shadows for dialog boxes and menus.
Mc 4.8.26 fails to compile on LibreELEC. - https://libreelec.tv/ - the Tagline being Just enough OS for KODI
We use --disable-widec in the ncurses build, https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/devel/ncurses/package.mk
Reverting the whole patch fixes the compile, but it would be ideal to use alternatives or limit shadows if wchar is not available.
Results of the failed compile
./.libs/libinternal.a(tty-ncurses.o):tty-ncurses.c:function tty_colorize_area: error: undefined reference to 'mvin_wchnstr'
./.libs/libinternal.a(tty-ncurses.o):tty-ncurses.c:function tty_colorize_area: error: undefined reference to 'getcchar'
./.libs/libinternal.a(tty-ncurses.o):tty-ncurses.c:function tty_colorize_area: error: undefined reference to 'setcchar'
./.libs/libinternal.a(tty-ncurses.o):tty-ncurses.c:function tty_colorize_area: error: undefined reference to 'mvadd_wchnstr'
Attachments
Change History
comment:3 Changed 4 years ago by andrew_b
- Status changed from new to closed
- Resolution set to invalid
- Component changed from mc-core to mc-tty
- Milestone Future Releases deleted
Fixed as #4181.
comment:4 Changed 4 years ago by mrbump
Whilst that patch fixed MacOS it doesn’t fix LibreELEC as wide char is not included. I had tested that patch as I had compiled against master https://github.com/MidnightCommander/mc/commits/master . If you could suggest a direction of what would be acceptable to the mc team, I would be happy to develop a code fix. As in tty-slang I see that tty_colorize_area is essentially a noop.
Should I write a —without-wchar configure option?
comment:5 Changed 4 years ago by zaytsev
How is it possible that LibreELEC doesn't have a definition of wchar_t? Kodi itself seems to use it all over the place... How do you solve this problem?
To me it seems that of course you do have wchar_t, only for some reason we cannot understand yet you compile ncurses with --disable-widec, so even though mc does compile against ncurses, according to your log the linking fails, because mvadd_wchnstr function cannot be found. Just compile ncurses --enable-widec to solve this problem if you can. I would be surprised if mc interface will be rendered correctly if you compile against ncurses with --disable-widec anyways.
comment:9 Changed 3 years ago by mrbump
Hi @andrew_b
we just pulled the patch into 4.8.27. And removed the previous revert patch. All works as expected. https://github.com/LibreELEC/LibreELEC.tv/pull/5562
Regards
Rudi
comment:10 Changed 3 years ago by andrew_b
- Status changed from closed to reopened
- Resolution invalid deleted
- Branch state changed from no branch to on review
- Milestone set to 4.8.28
Branch: 4200_ncurses_disable_widec
changeset:e7bbf72544ab62db9c92bfe7bd1155227e78c621
comment:11 Changed 3 years ago by andrew_b
- Votes for changeset set to mrbump andrew_b
- Branch state changed from on review to approved
comment:12 Changed 3 years ago by andrew_b
- Status changed from reopened to closed
- Votes for changeset changed from mrbump andrew_b to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
Merged to master: [375f2a764dc0d276e98cdcf0e9f890f41250c041].
The code that has the wchar is
+++ b/lib/tty/tty-ncurses.c
@@ -533,6 +550,38
/* --------------------------------------------------------------------------------------------- */
+void
+tty_colorize_area (int y, int x, int rows, int cols, int color)
+{
+ cchar_t *ctext;
+ wchar_t wch[10]; /* TODO not sure if the length is correct */
+ attr_t attrs;
+ short color_pair;
+
+ return;
+
+ tty_setcolor (color);
+ ctext = g_malloc (sizeof (cchar_t) * (cols + 1));
+
+ for (int row = 0; row < rows; row++)
+ {
+ mvin_wchnstr (y + row, x, ctext, cols);
+
+ for (int col = 0; col < cols; col++)
+ {
+ getcchar (&ctext[col], wch, &attrs, &color_pair, NULL);
+ setcchar (&ctext[col], wch, attrs, color, NULL);
+ }
+
+ mvadd_wchnstr (y + row, x, ctext, cols);