[Midnight Commander] #4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.

88 views
Skip to first unread message

Ticket System

unread,
Feb 13, 2021, 6:32:01 AM2/13/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------------+-------------------------------
Reporter: mrbump | Type: defect
Status: new | Priority: minor
Milestone: Future Releases | Component: mc-core
Version: 4.8.26 | Keywords:
Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------------+-------------------------------
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'

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200>
Midnight Commander <https://midnight-commander.org>
Midnight Development Center

Ticket System

unread,
Feb 13, 2021, 6:44:19 AM2/13/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+---------------------------------------
Reporter: mrbump | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-core | Version: 4.8.26
Resolution: | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by mrbump):

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;
+
+ if (!use_colors || !tty_clip (&y, &x, &rows, &cols))
+ 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);

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:1>

Ticket System

unread,
Feb 13, 2021, 6:57:38 AM2/13/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+---------------------------------------
Reporter: mrbump | Owner:

Type: defect | Status: new
Priority: minor | Milestone: Future Releases
Component: mc-core | Version: 4.8.26
Resolution: | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+---------------------------------------

Comment (by mrbump):

Original change that created the issue #4102

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:2>

Ticket System

unread,
Feb 13, 2021, 8:05:39 AM2/13/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed
Priority: minor | Milestone:
Component: mc-tty | Version: 4.8.26
Resolution: invalid | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+------------------------------
Changes (by andrew_b):

* status: new => closed
* resolution: => invalid
* component: mc-core => mc-tty
* milestone: Future Releases =>


Comment:

Fixed as #4181.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:3>

Ticket System

unread,
Feb 13, 2021, 7:53:09 PM2/13/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed
Priority: minor | Milestone:
Component: mc-tty | Version: 4.8.26
Resolution: invalid | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+------------------------------

Comment (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?

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:4>

Ticket System

unread,
Feb 14, 2021, 5:15:32 AM2/14/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed
Priority: minor | Milestone:
Component: mc-tty | Version: 4.8.26
Resolution: invalid | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+------------------------------

Comment (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.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:5>

Ticket System

unread,
Feb 15, 2021, 12:43:29 PM2/15/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed
Priority: minor | Milestone:
Component: mc-tty | Version: 4.8.26
Resolution: invalid | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+------------------------------

Comment (by andrew_b):

Please test the attached patch.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:6>

Ticket System

unread,
Feb 28, 2021, 9:03:02 AM2/28/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed
Priority: minor | Milestone:
Component: mc-tty | Version: 4.8.26
Resolution: invalid | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+------------------------------

Comment (by andrew_b):

ping

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:7>

Ticket System

unread,
Mar 7, 2021, 10:58:55 AM3/7/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed
Priority: minor | Milestone:
Component: mc-tty | Version: 4.8.26
Resolution: invalid | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+------------------------------

Comment (by andrew_b):

@mrbump, please let me know if this patch works or not.

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:8>

Ticket System

unread,
Aug 23, 2021, 9:52:23 AM8/23/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed
Priority: minor | Milestone:
Component: mc-tty | Version: 4.8.26
Resolution: invalid | Keywords:

Blocked By: | Blocking:
Branch state: no branch | Votes for changeset:
--------------------------+------------------------------

Comment (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

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:9>

Ticket System

unread,
Aug 28, 2021, 4:54:08 AM8/28/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
--------------------------+--------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: reopened
Priority: minor | Milestone: 4.8.28
Component: mc-tty | Version: 4.8.26
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: on review | Votes for changeset:
--------------------------+--------------------------------
Changes (by andrew_b):

* status: closed => reopened
* resolution: invalid =>
* branch_state: no branch => on review
* milestone: => 4.8.28


Comment:

Branch: 4200_ncurses_disable_widec
changeset:e7bbf72544ab62db9c92bfe7bd1155227e78c621

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:10>

Ticket System

unread,
Aug 28, 2021, 4:54:08 AM8/28/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
-----------------------+----------------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: closed

Priority: minor | Milestone: 4.8.28
Component: mc-tty | Version: 4.8.26
Resolution: fixed | Keywords:
Blocked By: | Blocking:
Branch state: merged | Votes for changeset: committed-master
-----------------------+----------------------------------------
Changes (by andrew_b):

* status: reopened => closed
* votes: mrbump andrew_b => committed-master
* resolution: => fixed
* branch_state: approved => merged


Comment:

Merged to master: [375f2a764dc0d276e98cdcf0e9f890f41250c041].

--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:12>

Ticket System

unread,
Aug 28, 2021, 4:54:08 AM8/28/21
to ru...@heitbaum.com, mc-...@googlegroups.com
#4200: If wchar is not included in ncurses, mc 4.8.26 fails to compile.
-------------------------+---------------------------------------
Reporter: mrbump | Owner:
Type: defect | Status: reopened

Priority: minor | Milestone: 4.8.28
Component: mc-tty | Version: 4.8.26
Resolution: | Keywords:
Blocked By: | Blocking:
Branch state: approved | Votes for changeset: mrbump andrew_b
-------------------------+---------------------------------------
Changes (by andrew_b):

* votes: => mrbump andrew_b
* branch_state: on review => approved


--
Ticket URL: <http://www.midnight-commander.org/ticket/4200#comment:11>

Reply all
Reply to author
Forward
0 new messages