Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

testing out 'error opening terminal: xterm'

989 views
Skip to first unread message

bilsch

unread,
Aug 12, 2016, 6:34:04 AM8/12/16
to
I wrote a C program that uses SDL for graphics and ncurses for user i/f.
Using GNU autotools I created a .deb file for installing the program
without the need to separately install the SDL and ncurses libraries and
headers. The .deb file installs the program and the program runs
perfectly on the (Ubuntu 14.04) system where I built both the program
and the .deb file.

I tested the .deb file (and the program) on two other Ubuntu 14.04
systems where SDL and ncurses were not installed: 1) a virtual machine
on the same PC and 2) a different PC. On both, the .deb file runs
(installs) without error. When the program itself is started it runs
until the point where an ncurses routine occurs, then it throws the error:

error opening terminal: xterm.

It seems odd that xterm is involved, since I always run the program in
gnome terminal. The TERM variable on all three machines is 'xterm'. The
opinion on the internet about the error is that xterm is not installed
correctly. A way of testing xterm is to run editor 'pico' which uses
xterm. Pico runs fine. If I change TERM variable to 'gnome' and try to
run pico editor it throws the same 'error opening terminal:xterm' error,
thus proving that pico does indeed use xterm and that apparently xterm
is installed correctly.

A further test. I copied the program created by the .deb file on the
virtual machine over to the host machine and ran it there. It does not
throw the error on that machine.

QUESTION: does anyone have an idea why the program throws the error?

TIA. Bill S.

Kaz Kylheku

unread,
Aug 12, 2016, 11:36:03 AM8/12/16
to
On 2016-08-12, bilsch <kin...@comcast.net> wrote:
> I wrote a C program that uses SDL for graphics and ncurses for user i/f.
> Using GNU autotools I created a .deb file for installing the program
> without the need to separately install the SDL and ncurses libraries and
> headers. The .deb file installs the program and the program runs
> perfectly on the (Ubuntu 14.04) system where I built both the program
> and the .deb file.
>
> I tested the .deb file (and the program) on two other Ubuntu 14.04
> systems where SDL and ncurses were not installed: 1) a virtual machine
> on the same PC and 2) a different PC. On both, the .deb file runs
> (installs) without error. When the program itself is started it runs
> until the point where an ncurses routine occurs, then it throws the error:
>
> error opening terminal: xterm.

Maybe this really means "cannot find the terminfo database entry for the
string 'xterm'?" Curses needs to look up the terminal type in a database
so it knows the correct escape sequences to use for controlling it.

Has it occurred to you to Google "error opening terminal" in quotes?

bilsch

unread,
Aug 13, 2016, 6:10:49 PM8/13/16
to
On a system with the xterm error, the README in /etc/terminfo says:

"This directory is for system-local terminfo descriptions. By default,
ncurses will search ${HOME}/.terminfo first, then /etc/terminfo (this
directory), then /lib/terminfo, and last /usr/share/terminfo."

In /lib/terminfo/x are these binary files:
xterm, xterm-256color, xterm-color, xterm-debian, xterm-mono,
xterm-r5, xterm-r6, xterm-vt220, xterm-xfree86

What else can I do?

As I said in my original post, pico editor, which uses xterm does not
get the error. Doesn't that indicate that xterm support is installed?

I did google "error opening terminal" and read the articles there
before posting my question in this group.

Nobody

unread,
Aug 13, 2016, 9:55:35 PM8/13/16
to
On Sat, 13 Aug 2016 15:10:44 -0700, bilsch wrote:

> What else can I do?

Is your program linked against the same ncurses library as pico?

Different libncurses binaries may have different search paths. If you try
to statically link ncurses, you'll end up with a binary which searches the
terminfo directories which are appropriate for the system on which the
program was built, but not necessarily for the system on which it is run.

E.g. not all systems use /lib/terminfo (/lib and /usr/lib are for
architecture-specific files, but terminfo files are portable).

Kaz Kylheku

unread,
Aug 14, 2016, 9:31:47 AM8/14/16
to
On 2016-08-14, Nobody <nob...@nowhere.invalid> wrote:
> On Sat, 13 Aug 2016 15:10:44 -0700, bilsch wrote:
>
>> What else can I do?
>
> Is your program linked against the same ncurses library as pico?
>
> Different libncurses binaries may have different search paths.

strace is your friend in ferreting out where a program is actually
searching for configuration info.

Richard Kettlewell

unread,
Aug 14, 2016, 10:08:58 AM8/14/16
to
bilsch <kin...@comcast.net> writes:
> I wrote a C program that uses SDL for graphics and ncurses for user
> i/f. Using GNU autotools I created a .deb file for installing the
> program without the need to separately install the SDL and ncurses
> libraries and headers. The .deb file installs the program and the
> program runs perfectly on the (Ubuntu 14.04) system where I built both
> the program and the .deb file.
>
> I tested the .deb file (and the program) on two other Ubuntu 14.04
> systems where SDL and ncurses were not installed: 1) a virtual machine
> on the same PC and 2) a different PC. On both, the .deb file runs
> (installs) without error. When the program itself is started it runs
> until the point where an ncurses routine occurs, then it throws the
> error:
>
> error opening terminal: xterm.

Do you have ncurses-base installed? That’s where the terminfo file for
‘xterm’ is.

> It seems odd that xterm is involved, since I always run the program in
> gnome terminal. The TERM variable on all three machines is
> 'xterm'. The opinion on the internet about the error is that xterm is
> not installed correctly. A way of testing xterm is to run editor
> 'pico' which uses xterm. Pico runs fine. If I change TERM variable
> to 'gnome' and try to run pico editor it throws the same 'error
> opening terminal:xterm' error, thus proving that pico does indeed use
> xterm and that apparently xterm is installed correctly.

The error message quotes the value of TERM, so I don’t think you can
have successfully changed it for this test. Unless you have terminfo
file for ‘gnome’ then I’m not sure what it’s supposed to achieve anyway.

--
http://www.greenend.org.uk/rjk/

Ian Zimmerman

unread,
Aug 14, 2016, 3:10:34 PM8/14/16
to
On 2016-08-12 03:33 -0700, bilsch wrote:

> Pico runs fine. If I change TERM variable to 'gnome' and try to run
> pico editor it throws the same 'error opening terminal:xterm' error,

Does it really say this, and not

error opening terminal:gnome

?

That would be very strange.

--
Please *no* private Cc: on mailing lists and newsgroups
Why does the arrow on Hillary signs point to the right?

bilsch

unread,
Aug 14, 2016, 4:19:39 PM8/14/16
to
>
> Do you have ncurses-base installed? That’s where the terminfo file for
> ‘xterm’ is.

I have several things with ncurses-base in the name. I don't see
anything like a terminfo file. ncurses-base itself says:

# The description refers to the terminfo entry which is lowercase.
ncurses-base: capitalization-error-in-description linux Linux

I think terminfo for xterm is in /lib/terminfo/x. It has these binary
files:
xterm, xterm-256color, xterm-color, xterm-debian, xterm-mono,
xterm-r5, xterm-r6, xterm-vt220, xterm-xfree86

What do you have in ncurses-base?

>
>> It seems odd that xterm is involved, since I always run the program in
>> gnome terminal. The TERM variable on all three machines is
>> 'xterm'. The opinion on the internet about the error is that xterm is
>> not installed correctly. A way of testing xterm is to run editor
>> 'pico' which uses xterm. Pico runs fine. If I change TERM variable
>> to 'gnome' and try to run pico editor it throws the same 'error
>> opening terminal:xterm' error, thus proving that pico does indeed use
>> xterm and that apparently xterm is installed correctly.
>
> The error message quotes the value of TERM, so I don’t think you can
> have successfully changed it for this test. Unless you have terminfo
> file for ‘gnome’ then I’m not sure what it’s supposed to achieve anyway.
>
I didn't say that right: with TERM=gnome the error is:
'error opening terminal:gnome'


bilsch

unread,
Aug 14, 2016, 4:21:23 PM8/14/16
to
On 08/14/2016 12:10 PM, Ian Zimmerman wrote:
> On 2016-08-12 03:33 -0700, bilsch wrote:
>
>> Pico runs fine. If I change TERM variable to 'gnome' and try to run
>> pico editor it throws the same 'error opening terminal:xterm' error,
>
> Does it really say this, and not
>
> error opening terminal:gnome
>
> ?
>
> That would be very strange.
>
yes. you are right. I said it wrong.

Richard Kettlewell

unread,
Aug 14, 2016, 4:40:46 PM8/14/16
to
bilsch <kin...@comcast.net> writes:
>> Do you have ncurses-base installed? That’s where the terminfo file for
>> ‘xterm’ is.
>
> I have several things with ncurses-base in the name. I don't see
> anything like a terminfo file. ncurses-base itself says:

I mean the ncurses-base package.

> # The description refers to the terminfo entry which is lowercase.
> ncurses-base: capitalization-error-in-description linux Linux

That looks like lintian output. I’ve no idea why you’re quoting that.

--
http://www.greenend.org.uk/rjk/

bilsch

unread,
Aug 14, 2016, 6:17:12 PM8/14/16
to

>
> I mean the ncurses-base package.
>
I did sudo apt-get install ncurses-base. It says:
ncurses-base is already the newest version.

I tried lsmod but I don't see any likely candidate listed.

So apparently I have it but I don't know where or what uses it or what
it contains.


bilsch

unread,
Aug 14, 2016, 8:05:47 PM8/14/16
to
>
> Is your program linked against the same ncurses library as pico?

I don't know about pico but my program (graf) is compiled and linked
without a makefile as follows:

gcc -Wall graf.c -o graf -lm -lSDL2 -lncurses


#include <ncurses.h>
#include <string.h>

#include <SDL2/SDL.h>

#include <stdio.h>

#include <time.h>

#include <stdlib.h>

#include <math.h>


I did strace graf and I got:

stat64("/home/bilsch01/.terminfo", 0x9350670) = -1 ENOENT
(No such file or directory)
stat64("/usr/share/terminfo", 0x9350670) = -1 ENOENT
(No such file or directory)
time(NULL) = 1471215095
write(2, "Error opening terminal: xterm.\n",

which tells me the paths it searched unsuccessfully.

Then
I did strace graf on the system with no error message. I got:

stat64("/home/bilsch/.terminfo", 0x815e670) = -1 ENOENT
(No such file or directory)
stat64("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
time(NULL) = 1471217712
access("/usr/share/terminfo/x/xterm", R_OK) = 0
open("/usr/share/terminfo/x/xterm", O_RDONLY|O_LARGEFILE) = 3

which tells me it searched different paths, and got the right one, which
is /usr/share/terminfo/x/xterm.

Possibly I could write the /x/xterm file to one of the paths being
searched by the errant graf program - but that is a klooj. Better to
get the errant graf program to search the path where /x/xterm file is.

What determines the paths searched by the errant graf program ?
How do I get my .deb file to hook this up correctly?

I have built many versions of the graf program and this is the first
time I got this problem.

Richard Kettlewell

unread,
Aug 15, 2016, 4:10:23 AM8/15/16
to
bilsch <kin...@comcast.net> writes:
>> I mean the ncurses-base package.
>>
> I did sudo apt-get install ncurses-base. It says:
> ncurses-base is already the newest version.
>
> I tried lsmod but I don't see any likely candidate listed.

lsmod is totally irrelevant here.

--
http://www.greenend.org.uk/rjk/

Richard Kettlewell

unread,
Aug 15, 2016, 4:16:33 AM8/15/16
to
bilsch <kin...@comcast.net> writes:
> I did strace graf and I got:
>
> stat64("/home/bilsch01/.terminfo", 0x9350670) = -1 ENOENT
> (No such file or directory)
> stat64("/usr/share/terminfo", 0x9350670) = -1 ENOENT
> (No such file or directory)
> time(NULL) = 1471215095
> write(2, "Error opening terminal: xterm.\n",
>
> which tells me the paths it searched unsuccessfully.
>
> Then
> I did strace graf on the system with no error message. I got:
>
> stat64("/home/bilsch/.terminfo", 0x815e670) = -1 ENOENT
> (No such file or directory)
> stat64("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> time(NULL) = 1471217712
> access("/usr/share/terminfo/x/xterm", R_OK) = 0
> open("/usr/share/terminfo/x/xterm", O_RDONLY|O_LARGEFILE) = 3
>
> which tells me it searched different paths, and got the right one,
> which is /usr/share/terminfo/x/xterm.
>
> Possibly I could write the /x/xterm file to one of the paths being
> searched by the errant graf program - but that is a klooj. Better to
> get the errant graf program to search the path where /x/xterm file is.
>
> What determines the paths searched by the errant graf program ?
> How do I get my .deb file to hook this up correctly?

What ‘ldd graf’ reveal on the two mcahines?

AFAICS the paths are baked into the ncurses libraries (specifically
libtinfo) when it is built. Does the anomalous machine have a local
build of ncurses?

--
http://www.greenend.org.uk/rjk/

Rainer Weikusat

unread,
Aug 15, 2016, 10:24:59 AM8/15/16
to
bilsch <kin...@comcast.net> writes:
>> Is your program linked against the same ncurses library as pico?
>
> I don't know about pico but my program (graf) is compiled and linked
> without a makefile as follows:
>
> gcc -Wall graf.c -o graf -lm -lSDL2 -lncurses

[...]

> I did strace graf and I got:

[...]

> stat64("/usr/share/terminfo", 0x9350670) = -1 ENOENT

[...]

> which tells me the paths it searched unsuccessfully.
>
> Then
> I did strace graf on the system with no error message. I got:

[...]

> stat64("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> access("/usr/share/terminfo/x/xterm", R_OK) = 0
> open("/usr/share/terminfo/x/xterm", O_RDONLY|O_LARGEFILE) = 3

[...]

> which tells me it searched different paths, and got the right one,

It tried the same top-level path (/usr/share/terminfo) on both
systems. On the first, the stat call ran into an ENOENT error which
means /usr/share/terminfo didn't exist there. Hence, the program not
trying to access /usr/share/terminfo/x/xterm afterwards seems
unsurprising: That's below /usr/share/terminfo. If that doesn't
exist, the other obviously cannot exist, either.

Eric Sosman

unread,
Aug 15, 2016, 10:39:01 AM8/15/16
to
On 8/14/2016 8:05 PM, bilsch wrote:
>[...]
> I did strace graf and I got:
>
> stat64("/home/bilsch01/.terminfo", 0x9350670) = -1 ENOENT
> (No such file or directory)
> stat64("/usr/share/terminfo", 0x9350670) = -1 ENOENT
> (No such file or directory)
> time(NULL) = 1471215095
> write(2, "Error opening terminal: xterm.\n",
>
> which tells me the paths it searched unsuccessfully.
>
> Then
> I did strace graf on the system with no error message. I got:
>
> stat64("/home/bilsch/.terminfo", 0x815e670) = -1 ENOENT
> (No such file or directory)
> stat64("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...})
> = 0
> time(NULL) = 1471217712
> access("/usr/share/terminfo/x/xterm", R_OK) = 0
> open("/usr/share/terminfo/x/xterm", O_RDONLY|O_LARGEFILE) = 3
>
> which tells me it searched different paths, and got the right one, which
> is /usr/share/terminfo/x/xterm.

Looks like they searched the *same* paths -- at least, the
first searched the same path prefix as the second, and bailed
out when that prefix was found not to exist. Conclusion: On the
system where things fail, the directory /usr/share/terminfo does
not exist, though the program searches for things beneath that
location.

--
eso...@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Ian Zimmerman

unread,
Aug 15, 2016, 11:23:28 AM8/15/16
to
On 2016-08-13 15:10 -0700, bilsch wrote:

> In /lib/terminfo/x are these binary files:
> xterm, xterm-256color, xterm-color, xterm-debian, xterm-mono,
> xterm-r5, xterm-r6, xterm-vt220, xterm-xfree86
>
> What else can I do?

On this system, run

dpkg -S /lib/terminfo/x

On the other system, run

dpkg -S /usr/share/terminfo/x

Post the output.

Are both the same Ubuntu version? Do they have the same versions of
packages installed? Has one been updated but not the other?

Scott Lurndal

unread,
Aug 15, 2016, 12:43:24 PM8/15/16
to
Ian Zimmerman <i...@buug.org> writes:
>On 2016-08-13 15:10 -0700, bilsch wrote:
>
>> In /lib/terminfo/x are these binary files:
>> xterm, xterm-256color, xterm-color, xterm-debian, xterm-mono,
>> xterm-r5, xterm-r6, xterm-vt220, xterm-xfree86
>>
>> What else can I do?
>
>On this system, run
>
>dpkg -S /lib/terminfo/x
>
>On the other system, run
>
>dpkg -S /usr/share/terminfo/x
>
>Post the output.
>
>Are both the same Ubuntu version? Do they have the same versions of
>packages installed? Has one been updated but not the other?

Note that the user can set TERMINFO in the environment to point to a user-selected
directory which contains terminfo files.

Note that one can use the infocmp(1) command to extract a compilable
terminfo description from a binary terminfo file.

Note that one can use tic(1) command to compile a terminfo description
into a binary terminfo file.

Using those three 'Notes', one can copy a terminfo file from the
system where it exists to the system where it doesn't exist.

man -k terminfo
man 1 tic
man 1 infocmp
man 5 terminfo

bilsch

unread,
Aug 18, 2016, 6:40:58 AM8/18/16
to
On 08/15/2016 08:23 AM, Ian Zimmerman wrote:
> On 2016-08-13 15:10 -0700, bilsch wrote:
>
>> In /lib/terminfo/x are these binary files:
>> xterm, xterm-256color, xterm-color, xterm-debian, xterm-mono,
>> xterm-r5, xterm-r6, xterm-vt220, xterm-xfree86
>>
>> What else can I do?
>
> On this system, run
>
> dpkg -S /lib/terminfo/x
>
> On the other system, run
>
> dpkg -S /usr/share/terminfo/x
>
> Post the output.
>
> Are both the same Ubuntu version? Do they have the same versions of
> packages installed? Has one been updated but not the other?
>
Please disregard what I said about /lib/terminfo/x - it confuses the
issue.

Two systems. Please tell me which dpkg line to use with each one.

The first is a well used Ubuntu 14.04 system with an ncurses 5.9 package
(aka ncurses 6.0) from official website installed. I do not remember if
the ncurses package was compiled here or if it is binaries that I
downloaded. The graf executable runs on this system. The .deb file was
built on this system. The .deb file was never run on this system.
The first system has xterm file at /usr/share/terminfo/x/.

The second system is a fresh install of Ubuntu 14.04 (with updates). The
.deb file has been run on this system, thus (hopefully) installing the
necessary ncurses files, but the ncurses package was not otherwise
installed here. The graf executable generated on the second system by
running the .deb file gets the error "error opening terminal: xterm"
when run on the second system, but the graf executable runs without
error on the first system - where the .deb file was built.

The .deb file, which builds graf (executable) and installs ncurses
library does not install an xterm file in either path
/usr/share/terminfo/x or /home/bilsch01/.terminfo, even though the
graf executable searches for xterm in only those two locations. This
seems to me like a fault in the .deb file.

Does this sound like a faulty .deb file to you ?




Rainer Weikusat

unread,
Aug 18, 2016, 11:48:42 AM8/18/16
to
Do you actually read replies you get? Judging from the strace output you
posted, the 2nd system doesn't have the terminfo database installed in
/usr/share/terminfo. As determine by spending about 5 minutes looking at
the 14.04 package listings, the essential ncurses-base packages provides
some terminal defnitions in /lib/terminfo (this makes little sense as
they architecture independent but systemd developers haven't discovered
computer networks beyond 'the WWW' yet and thus, don't believe in
them). The ncurses-term package provides additional terminal definitions
below /usr/share/terminfo. Your problem could possibly vanish by
installing this package.

HOWEVER,

A much more interesting question is "Why isn't your program using the
proper terminfo search path for the system it's supposed to run
on?". The Debian/ Ubuntu curses is compiled with

--with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" \

The one your program is using seems to restrict itself of the default
path of the ncurses source package.

Did you per chance link that statically on the misguided assumption
that this would be some kind of magic bullet worthy of having on its
own?

bilsch

unread,
Aug 18, 2016, 6:29:09 PM8/18/16
to
Yes. I Don't always understand everything in them.

Judging from the strace output you
> posted, the 2nd system doesn't have the terminfo database installed in
> /usr/share/terminfo.

Yes.


> As determine by spending about 5 minutes looking at
> the 14.04 package listings, the essential ncurses-base packages provides
> some terminal defnitions in /lib/terminfo (this makes little sense as
> they architecture independent but systemd developers haven't discovered
> computer networks beyond 'the WWW' yet and thus, don't believe in
> them). The ncurses-term package provides additional terminal definitions
> below /usr/share/terminfo. Your problem could possibly vanish by
> installing this package.

The objective is to create a .deb file that provides functionality to
run the graf executable on a freshly installed Ubuntu system. Maybe it
is unrealistic. I don't think you are saying install ncurses-term on
the first system thereby resulting in a better .deb file that matches up
a term file with a search path. Or am I mistaken thinking the .deb file
can do anything like that?

>
> HOWEVER,
>
> A much more interesting question is "Why isn't your program using the
> proper terminfo search path for the system it's supposed to run
> on?". The Debian/ Ubuntu curses is compiled with
>
> --with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" \
>
> The one your program is using seems to restrict itself of the default
> path of the ncurses source package.


I don't know.

>
> Did you per chance link that statically on the misguided assumption
> that this would be some kind of magic bullet worthy of having on its
> own?
>
I've never static linked while doing any of this.


bilsch

unread,
Aug 18, 2016, 6:43:03 PM8/18/16
to
I should reinstall the ncurses package

Scott Lurndal

unread,
Aug 19, 2016, 9:10:16 AM8/19/16
to
bilsch <kin...@comcast.net> writes:

>
>The objective is to create a .deb file that provides functionality to
>run the graf executable on a freshly installed Ubuntu system. Maybe it
>is unrealistic. I don't think you are saying install ncurses-term on
>the first system thereby resulting in a better .deb file that matches up
>a term file with a search path. Or am I mistaken thinking the .deb file
>can do anything like that?

So, in your 'graf' .deb file, specify ncurses-base as a dependency and
the package manager will handle loading it.

Rainer Weikusat

unread,
Aug 19, 2016, 9:42:30 AM8/19/16
to
ncurses-base is 'required' and should this always exist. But in Ubuntu
14.04, it only provides terminal definitions in /lib/terminfo.

Richard Kettlewell

unread,
Aug 19, 2016, 11:03:45 AM8/19/16
to
Rainer Weikusat <rwei...@talktalk.net> writes:
> sc...@slp53.sl.home (Scott Lurndal) writes:
>> bilsch <kin...@comcast.net> writes:

>>>The objective is to create a .deb file that provides functionality to
>>>run the graf executable on a freshly installed Ubuntu system. Maybe
>>>it is unrealistic. I don't think you are saying install ncurses-term
>>>on the first system thereby resulting in a better .deb file that
>>>matches up a term file with a search path. Or am I mistaken thinking
>>>the .deb file can do anything like that?
>>
>> So, in your 'graf' .deb file, specify ncurses-base as a dependency and
>> the package manager will handle loading it.

That is completely the wrong approach.

> ncurses-base is 'required' and should this always exist. But in Ubuntu
> 14.04, it only provides terminal definitions in /lib/terminfo.

...which includes xterm[1]. And the libtinfo from that version will
look there by default:

[1] http://packages.ubuntu.com/trusty/all/ncurses-base/filelist

$ strings -a lib/x86_64-linux-gnu/libtinfo.so.5|grep terminfo
_nc_home_terminfo
/etc/terminfo
/etc/terminfo:/lib/terminfo:/usr/share/terminfo
%s/.terminfo

So either bilsch isn’t using the standard version of the library or they
have somehow configured it so that it does not work. Hence asking for
ldd output.

--
http://www.greenend.org.uk/rjk/

Nicolas George

unread,
Aug 19, 2016, 11:11:57 AM8/19/16
to
Richard Kettlewell , dans le message
<8760qw3...@LkoBDZeT.terraraq.uk>, a écrit :
> So either bilsch isn’t using the standard version of the library or they
> have somehow configured it so that it does not work. Hence asking for
> ldd output.

Have you noticed how people who have weird problems always answer first to
messages that suggest random non-solutions and never to messages that follow
competent diagnosing protocol?

Richard Kettlewell

unread,
Aug 19, 2016, 11:24:32 AM8/19/16
to
Nicolas George <nicolas$geo...@salle-s.org> writes:
> Richard Kettlewell writes:
>> So either bilsch isn’t using the standard version of the library or they
>> have somehow configured it so that it does not work. Hence asking for
>> ldd output.
>
> Have you noticed how people who have weird problems always answer first to
> messages that suggest random non-solutions and never to messages that follow
> competent diagnosing protocol?

Yes l-)

--
http://www.greenend.org.uk/rjk/

Ian Zimmerman

unread,
Aug 19, 2016, 3:18:36 PM8/19/16
to
On 2016-08-18 15:29 -0700, bilsch wrote:

> The objective is to create a .deb file that provides functionality to
> run the graf executable on a freshly installed Ubuntu system. Maybe it
> is unrealistic. I don't think you are saying install ncurses-term on
> the first system thereby resulting in a better .deb file that matches
> up a term file with a search path. Or am I mistaken thinking the .deb
> file can do anything like that?

One problem in helping you is that you keep using this funny language
"run a deb file". A deb is not an executable; it is a data file for the
packaging system. Because you say this one has the feeling of not
knowing what it is precisely you do.

More specifically: I am not sure anymore that your deb doesn't actually
include a copy of ncurses. It doesn't, right? If it does, _change
that_. Do not bundle libraries like that. Make your package _depend_
on libncurses5, and optionally on ncurses-term.

Rainer Weikusat

unread,
Aug 19, 2016, 4:16:10 PM8/19/16
to
bilsch <kin...@comcast.net> writes:
> On 08/18/2016 08:48 AM, Rainer Weikusat wrote:

[ncurses program can't find xterm terminal definition on Unbutu 14.04]


>> posted, the 2nd system doesn't have the terminfo database installed in
>> /usr/share/terminfo.
>
> Yes.
>
>
>> As determine by spending about 5 minutes looking at
>> the 14.04 package listings, the essential ncurses-base packages provides
>> some terminal defnitions in /lib/terminfo (this makes little sense as
>> they architecture independent but systemd developers haven't discovered
>> computer networks beyond 'the WWW' yet and thus, don't believe in
>> them). The ncurses-term package provides additional terminal definitions
>> below /usr/share/terminfo. Your problem could possibly vanish by
>> installing this package.
>
> The objective is to create a .deb file that provides functionality to
> run the graf executable on a freshly installed Ubuntu system. Maybe it
> is unrealistic. I don't think you are saying install ncurses-term on
> the first system thereby resulting in a better .deb file that matches
> up a term file with a search path. Or am I mistaken thinking the .deb
> file can do anything like that?

You could declare a dependency on ncurses-term. This would probably hide
the problem with your binary.

>> HOWEVER,
>>
>> A much more interesting question is "Why isn't your program using the
>> proper terminfo search path for the system it's supposed to run
>> on?". The Debian/ Ubuntu curses is compiled with
>>
>> --with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" \
>>
>> The one your program is using seems to restrict itself of the default
>> path of the ncurses source package.
>
> I don't know.

I do, at least if the strace output you posted was complete
enough. According to the Debian/ Ubuntu ncurses source package, the
library should search for terminfo files in /etc/terminfo, /lib/terminfo
and /usr/share/terminfo. Hence, it should find the xterm definition in
/lib/terminfo. But the library your program uses apparently doesn't do
that. That's the issue to investigate here. A first step towards that
would be (as already suggested) to run ldd on your program and one some
curses-using program which works, eg, pico, and compare the output.


bilsch

unread,
Aug 20, 2016, 9:12:36 AM8/20/16
to
Here is the ldd output.
Note: a message during creation of the .deb file says ncurses library is
imbedded.

bilsch01@bilsch01-VirtualBox:/usr/bin$ ldd pico
linux-gate.so.1 => (0xb77a1000)
libncursesw.so.5 => not found
libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0xb7766000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb75b6000)
/lib/ld-linux.so.2 (0x8009a000)
bilsch01@bilsch01-VirtualBox:/usr/bin$ cd /home/bilsch01
bilsch01@bilsch01-VirtualBox:~$ ldd grafeotx
linux-gate.so.1 => (0xb77b8000)
libSDL2-2.0.so.0 => /usr/lib/i386-linux-gnu/libSDL2-2.0.so.0 (0xb768b000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7645000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7495000)
libasound.so.2 => /usr/lib/i386-linux-gnu/libasound.so.2 (0xb739f000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb739a000)
libpulse-simple.so.0 => /usr/lib/i386-linux-gnu/libpulse-simple.so.0
(0xb7395000)
libpulse.so.0 => /usr/lib/i386-linux-gnu/libpulse.so.0 (0xb7346000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb7211000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb71fe000)
libXcursor.so.1 => /usr/lib/i386-linux-gnu/libXcursor.so.1 (0xb71f3000)
libXinerama.so.1 => /usr/lib/i386-linux-gnu/libXinerama.so.1 (0xb71ef000)
libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb71df000)
libXrandr.so.2 => /usr/lib/i386-linux-gnu/libXrandr.so.2 (0xb71d3000)
libXss.so.1 => /usr/lib/i386-linux-gnu/libXss.so.1 (0xb71cf000)
libXxf86vm.so.1 => /usr/lib/i386-linux-gnu/libXxf86vm.so.1 (0xb71c9000)
libwayland-egl.so.1 => /usr/lib/i386-linux-gnu/libwayland-egl.so.1
(0xb71c6000)
libwayland-client.so.0 =>
/usr/lib/i386-linux-gnu/libwayland-client.so.0 (0xb71ba000)
libwayland-cursor.so.0 =>
/usr/lib/i386-linux-gnu/libwayland-cursor.so.0 (0xb71b0000)
libxkbcommon.so.0 => /usr/lib/i386-linux-gnu/libxkbcommon.so.0 (0xb7174000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7158000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb714f000)
/lib/ld-linux.so.2 (0x8008f000)
libpulsecommon-4.0.so =>
/usr/lib/i386-linux-gnu/pulseaudio/libpulsecommon-4.0.so (0xb70df000)
libjson-c.so.2 => /lib/i386-linux-gnu/libjson-c.so.2 (0xb70d4000)
libdbus-1.so.3 => /lib/i386-linux-gnu/libdbus-1.so.3 (0xb7089000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb7067000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb705c000)
libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xb7055000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb704e000)
libwrap.so.0 => /lib/i386-linux-gnu/libwrap.so.0 (0xb7044000)
libsndfile.so.1 => /usr/lib/i386-linux-gnu/libsndfile.so.1 (0xb6fd2000)
libasyncns.so.0 => /usr/lib/i386-linux-gnu/libasyncns.so.0 (0xb6fcb000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb6fc6000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb6fbf000)
libnsl.so.1 => /lib/i386-linux-gnu/libnsl.so.1 (0xb6fa6000)
libFLAC.so.8 => /usr/lib/i386-linux-gnu/libFLAC.so.8 (0xb6f72000)
libvorbisenc.so.2 => /usr/lib/i386-linux-gnu/libvorbisenc.so.2 (0xb6dfa000)
libvorbis.so.0 => /usr/lib/i386-linux-gnu/libvorbis.so.0 (0xb6dcd000)
libogg.so.0 => /usr/lib/i386-linux-gnu/libogg.so.0 (0xb6dc4000)
libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xb6dac000)

Richard Kettlewell

unread,
Aug 20, 2016, 10:17:38 AM8/20/16
to
bilsch <kin...@comcast.net> writes:
> Richard Kettlewell wrote:
>> So either bilsch isn’t using the standard version of the library or
>> they have somehow configured it so that it does not work. Hence
>> asking for ldd output.
>
> Here is the ldd output.
> Note: a message during creation of the .deb file says ncurses library
> is imbedded.

Please get into the habit of using copy and paste to report messages,
rather than inaccurately re-typing them. In this case you are probably
referring to https://lintian.debian.org/tags/embedded-library.html.

> bilsch01@bilsch01-VirtualBox:/usr/bin$ cd /home/bilsch01
> bilsch01@bilsch01-VirtualBox:~$ ldd grafeotx

Your program was called ‘graf’ when you posted strace output. What’s
the reason for the discrepancy?

> linux-gate.so.1 => (0xb77b8000)
[...]

None of the curses libraries appear in this list, and Lintian is warning
you that you are statically linked against ncurses. You may wish to
reflect on the fact that it’s taken most of a week to determine this
from the first request for ldd output, or that Rainer also guessed it a
couple of days back.

Anyway since it has a different terminfo search path to the Debian &
Ubuntu builds I think it must be your own local build of ncurses, or
possibly one from some other Linux distribution.

--
http://www.greenend.org.uk/rjk/

bilsch

unread,
Aug 20, 2016, 11:51:31 AM8/20/16
to

>> ldd grafeotx
>

eotx = error opening terminal:xterm

>
> None of the curses libraries appear in this list

I did ldd right away and was puzzled by no ncurses library because the
program does run on the system where it was built - just doesn't run on
system with no ncurses installed. That's the whole problem.

The .deb file should provide the ncurses info - thats the point. You
don't have to install ncurses (or SDL) on your PC in order to run graf.


> you are statically linked against ncurses.

gcc -Wall graf.c -o graf -lm -lSDL2 -lncurses
that's not static linking


> I think it must be your own local build of ncurses

then it must be, but I don't know why that's a problem.

Richard Kettlewell

unread,
Aug 20, 2016, 12:05:21 PM8/20/16
to
bilsch <kin...@comcast.net> writes:

>> None of the curses libraries appear in this list
>
> I did ldd right away and was puzzled by no ncurses library because the
> program does run on the system where it was built - just doesn't run
> on system with no ncurses installed. That's the whole problem.
>
> The .deb file should provide the ncurses info - thats the point. You
> don't have to install ncurses (or SDL) on your PC in order to run
> graf.

This is not really a sensible approach when targetting Debian/Ubuntu
systems. Install the dependencies on the target in the normal way
(i.e. apt-get install). Don’t attempt to package them as part of your
application.

>> you are statically linked against ncurses.
>
> gcc -Wall graf.c -o graf -lm -lSDL2 -lncurses
> that's not static linking

You can’t tell from that line on its own.

You *can* tell from ldd, and the answer is: you did not dynamically link
against ncurses.

>> I think it must be your own local build of ncurses
>
> then it must be, but I don't know why that's a problem.

Because it doesn’t know where to look for the terminfo files on the
target system.

--
http://www.greenend.org.uk/rjk/

bilsch

unread,
Aug 20, 2016, 1:15:19 PM8/20/16
to
My debian/control file is shown below. I tried adding a couple of
things to 'Build-Depends' and 'Depends' but it doesn't like my syntax. I
checked the debian policy manual to find examples. None. Do you know
the syntax for adding 'ncurses-base' to Depends: ?

Source: graf
Maintainer: bilsch01 <bils...@gmail.com>
Section: misc
Priority: optional
Standards-Version: 3.9.5
Build-Depends: debhelper (>= 9)

Package: graf
Architecture: i386
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: plots parametric graphs
graf plots parametric graphs with periodic functions on x & y-axes.

Richard Kettlewell

unread,
Aug 20, 2016, 5:14:11 PM8/20/16
to
bilsch <kin...@comcast.net> writes:
> My debian/control file is shown below. I tried adding a couple of
> things to 'Build-Depends' and 'Depends' but it doesn't like my
> syntax. I checked the debian policy manual to find examples. None. Do
> you know the syntax for adding 'ncurses-base' to Depends: ?

Don’t do that; it’s not likely to solve the actual problem, which seems
to be to do with how you build your program.

> Source: graf
> Maintainer: bilsch01 <bils...@gmail.com>
> Section: misc
> Priority: optional
> Standards-Version: 3.9.5
> Build-Depends: debhelper (>= 9)
>
> Package: graf
> Architecture: i386

Should probably be Architecture: any.

> Depends: ${shlibs:Depends}, ${misc:Depends}}
> Description: plots parametric graphs
> graf plots parametric graphs with periodic functions on x & y-axes.

--
http://www.greenend.org.uk/rjk/

Rainer Weikusat

unread,
Aug 21, 2016, 2:54:31 PM8/21/16
to
bilsch <kin...@comcast.net> writes:

[...]

>> you are statically linked against ncurses.
>
> gcc -Wall graf.c -o graf -lm -lSDL2 -lncurses
> that's not static linking

That's linking with the first ncurses version the linker found in it's
search path.

bilsch

unread,
Aug 30, 2016, 8:07:29 AM8/30/16
to
Using your suggestions and tools you showed me, I created a .deb file
that installs the SDL files and the graf program on a fresh Ubuntu 14.04
install. The ncurses files all come with the Ubuntu install. I made
ncurses-base a dependency. I ran ./configure with some
"--with-terminfo-dirs=" options set.

I checked the system for libSDL.bla.bla files and there were none before
I ran the .deb file - but afterwards there are plenty, and some are
large, like 1.1 MB. This is what I planned for but I am surprised that
the .deb file is not 2MB or more. The .deb file is only 11.7k, so where
did all these libSDL files come from?

Thanks for the help. Bill S.

Richard Kettlewell

unread,
Aug 30, 2016, 8:12:59 AM8/30/16
to
Publish the .deb somewhere, trying to guess what you’ve done from your
descriptions is impractical.

--
http://www.greenend.org.uk/rjk/

bilsch

unread,
Aug 30, 2016, 5:30:45 PM8/30/16
to
I tried to upload the folder with the automake and debuild files but
github says they are hidden, so I didn't upload those. Here's the link
to the .deb file:

https://github.com/bilsch01/graf0816

Richard Kettlewell

unread,
Aug 30, 2016, 6:14:05 PM8/30/16
to
Depends: libc6 (>= 2.7), libncurses5 (>= 5.5-5~), libsdl2-2.0-0 (>= 2.0.0),
libtinfo5, ncurses-base (>= 5.9)
^^^^^^^^^^^^

There is no need for this, ncurses-base is an essential package and
will always be installed.

$ objdump -x usr/bin/graf |grep NEEDED
NEEDED libSDL2-2.0.so.0
NEEDED libncurses.so.5
NEEDED libtinfo.so.5
NEEDED libm.so.6
NEEDED libc.so.6

That looks right.

As far as I can see you have made a dynamically linked executable which
depends on the right library packages. If they weren’t installed
previously then I expect you used apt-get to install your package, which
caused them to be installed automatically. That’s how it’s supposed to
work.

--
http://www.greenend.org.uk/rjk/
0 new messages