[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem producing portable linux binary using ncurses
From: |
Sven Joachim |
Subject: |
Re: Problem producing portable linux binary using ncurses |
Date: |
Sun, 26 Jun 2011 12:00:38 +0200 |
User-agent: |
Gnus/5.110017 (No Gnus v0.17) Emacs/23.3.50 (gnu/linux) |
On 2011-06-26 03:32 +0200, Eric P. Mangold wrote:
> I'm hoping someone here can help me with an ncurses issue, but first
> let me explain what I'm trying to accomplish.
>
> I have a program (darcs - a revision control system), which I am
> compiling on Debian Sarge, and it is linked to libncurses.
>
> I'm packing this binary along with the shared libraries it uses using
> a program called Ermine, which incidentally is quite nice for this
> sort of thing - but it doesn't solve all portability problems.
Actually it creates new ones, since the terminfo database might be set
up differently from distribution to distribution.
> The problem is that certain operations, like "darcs record", utilize
> ncurses, which results in ncurses trying to find a suitable terminfo
> file for the $TERM the user has set.
>
> For example, if $TERM=xterm, it will look here: /usr/share/terminfo/x/xterm
>
> This file exists on Debian Sarge and all is well. But on Debian Lenny,
> for example, this file does not exist, and so the program crashes with
> "setupTerm: Couldn't look up terminfo entry "xterm"".
I think you mean Squeeze, not Lenny.
> An strace clearly shows that the missing terminfo file is what causes the
> crash.
>
> On Lenny, there is no /usr/share/terminfo/x/xterm, there is only files
> named like "xterm-old" and various other filenames like that...
>
> So I though "OH, I'll just compile latest ncurses library on sarge,
> and it will understand how to access terminfo files using the new
> naming conventions", but alas no, even ncurses 5.9 compiled on sarge
> and linked to my program, still only looks for a plain "xterm" file
> when packed with my binary and run on debian lenny.
>
> So I'm looking for a solution that will allow a single binary linked
> with a bundled ncurses library to work on both systems. I'm happy to
> modify ncurses code to achieve this, if that is the only way (could
> use some pointers on where to find the routines that look up terminfo
> files).
You should build ncurses so that the library looks at least under
/lib/terminfo as well as /usr/share/terminfo. The Debian ncurses
package is configured with
--with-default-terminfo-dir=/usr/share/terminfo \
--with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo"
The xterm terminfo exists only under /lib/terminfo in Debian 6.0 and
later.
I would also suggest to use the system library by default (e.g. only set
LD_LIBRARY_PATH if it cannot be found, which should only be possible on
64-bit systems).
Regards,
Sven