Can't find a valid termcap file

Questions and problems about using polymake go here.
ren
Posts: 38
Joined: 03 May 2011, 15:21

Can't find a valid termcap file

Postby ren » 05 Jun 2017, 17:08

I built successfully built polymake 3.1 on a compute server in Kaiserslautern (4.4.6-gentoo), but I get the following error when I try to start it with the option '--no-config':

Code: Select all

ren@nenekiki ~ $ polymake --no-config Welcome to polymake version 3.1 Copyright (c) 1997-2017 Ewgenij Gawrilow, Michael Joswig (TU Berlin) http://www.polymake.org [...] Loading applications now...Can't find a valid termcap file at /users/cip/users/ren/share/polymake/perllib/Polymake/Core/InteractiveCommands.pm line 28.
My terminal is

Code: Select all

ren@nenekiki ~ $ echo $TERM xterm-256color
and there is a corresponding file for it on the server

Code: Select all

ren@nenekiki ~ $ ls /etc/terminfo/x/xterm-256color /etc/terminfo/x/xterm-256color
And termcap.h also exist in /usr/include/

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Can't find a valid termcap file

Postby gawrilow » 06 Jun 2017, 00:12

I don't think it looks for a header file, there are no modules in polymake including it. The message comes from the perl module Term::Cap which is usually pre-installed together with perl on most systems. You might have an outdated copy of it somewhere apart from the system package; you can check it for example by executing

Code: Select all

perl -MTerm::Cap -e 'print $INC{"Term/Cap.pm"}, "\n"'
Or your collection of terminfo files might be incomplete or somehow corrupted. On Ubuntu they live scattered in /lib/terminfo and /usr/share/terminfo belonging to various packages with 'ncurses' in their names, maybe it's similar on Gentoo. You say that it's a server, maybe it has got a "headless" installation profile where various user front-end package families like xorg or ncurses are reduced to a mininum.

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Can't find a valid termcap file

Postby gawrilow » 06 Jun 2017, 15:44

One more remark: Browsing the implementation of Term/Cap.pm, one can see that it consults two environment variables, TERMCAP and TERMPATH, when initializing its internal dictionaries. If one of them happens to be set and points in a wrong direction (that is, to a non-existing or incomplete terminfo database), then the error you observe is easily explicable.

vdelecroix
Posts: 19
Joined: 08 Jul 2016, 23:06

Re: Can't find a valid termcap file

Postby vdelecroix » 21 Aug 2019, 19:29

I got the same trouble with "rxvt-unicode (urxvt) v9.22 - released: 2016-01-23" on archlinux and polymake 3.4.

The bit of configuration that seems to be relevant is here

Code: Select all

$ echo $TERM rxvt-unicode-256color $ echo $TERMCAP $ echo $TERMPATH $ perl -MTerm::Cap -e 'print $INC{"Term/Cap.pm"}, "\n"' /usr/share/perl5/core_perl/Term/Cap.pm

Note that it works fine uxing xterm instead of urxvt.

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Can't find a valid termcap file

Postby gawrilow » 22 Aug 2019, 00:16

Just tested on my ubuntu 18.04 with both TERM=xterm-256color and TERM=rxvt-unicode-256color, polymake works without complaints.
Both settings are valid because there are corresponding files installed with ncurses-base package: /lib/terminfo/x/xterm-256color
and /lib/terminfo/r/rxvt-unicode-256color.

On your archlinux, the paths and package names might slightly differ, but the idea should be the same: TERM setting should correspond to an existing entity in the terminfo database.

vdelecroix
Posts: 19
Joined: 08 Jul 2016, 23:06

Re: Can't find a valid termcap file

Postby vdelecroix » 22 Aug 2019, 16:40

On my archlinux the files exist with the exact same path

Code: Select all

$ ls /lib/terminfo/x/xterm-256color /lib/terminfo/x/xterm-256color $ ls /lib/terminfo/r/rxvt-unicode-256color /lib/terminfo/r/rxvt-unicode-256color

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Can't find a valid termcap file

Postby gawrilow » 22 Aug 2019, 17:06

Well, then the only way to investigate the root cause of the error is to descend with perl debugger into Term::Cap...

vdelecroix
Posts: 19
Joined: 08 Jul 2016, 23:06

Re: Can't find a valid termcap file

Postby vdelecroix » 22 Aug 2019, 17:32

I have no idea how to do that (but would be happy trying to debug the problem).

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Can't find a valid termcap file

Postby gawrilow » 23 Aug 2019, 16:27

Start polymake under perl debugger:

$ perl -d where/it/is/bin/polymake

On the debugger prompt "DB<1>", enter

b load /usr/share/perl5/core_perl/Term/Cap.pm
c

When is stops, enter

b Tgetent
c

When it stops again, step through line by line, using "n" and "s" commands, like in gdb. Another important command is "p" for printing variables. The full command list is available (in a very brief form) by entering "?".
You should see then at which locations it tries to find terminfo files and why it does not like what it founds.

vdelecroix
Posts: 19
Joined: 08 Jul 2016, 23:06

Re: Can't find a valid termcap file

Postby vdelecroix » 23 Aug 2019, 19:30

After the first command in the debugger I got an illegal division

Code: Select all

DB<1> load /usr/share/perl5/core_perl/Term/Cap.pm Illegal division by zero at (eval 134)[/usr/share/perl5/core_perl/perl5db.pl:738] line 2.


Return to “Helpdesk”