help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trying to solve some missing symbols during linking (porting to Plan


From: Jens Staal
Subject: Re: trying to solve some missing symbols during linking (porting to Plan9)
Date: Sun, 13 Oct 2024 05:08:09 +0200

On Sat, Oct 12, 2024 at 04:45:09PM -0400, Chet Ramey wrote:
> On 10/10/24 5:38 AM, Jens Staal wrote:
> > Dear all,
> > 
> > I am currently trying to compile Bash on Plan9 (9front) using APExp (a
> > GNU/posix compatibility environment). I have all the bash object files
> > and libraries compiled and I only get one weird issue during linking:
> > 
> > chdir: BC: not defined
> > chdir: PC: not defined
> > chdir: UP: not defined
> > 
> > grepping the libraries shows that chdir is in libbuiltins.a
> > and that should correspond to builtins/cd.def
> 
> I think the `chdir' is a red herring.
> 
> Those are termcap/terminfo library symbols. As Branden says in his
> reply, bash usually resolves those from the ncurses or terminfo
> libraries. Does your posix environment have those?
>

No it does not. It has some stub functions in pdcursesmod term.h and
there is a "terminfo" file in the vt emulation program in
/sys/src/cmd/vt, but nothing that I think I can use to satisfy that
dependency.

> The configuration process looks for a bunch of different curses/
> termcap/terminfo libraries, and writes the ones it uses to the
> TERMCAP_LIB and TERMCAP_DEP Makefile variables. What are those set to?
> 

It picked up on my pdcursesmod curses, but I have tried to link with
libtermcap (in the bash source tree) as well.

> These variables are declared extern in ncurses.h/termcap.h, and historical
> versions of the termcap library, including the ancient version in
> lib/termcap in the bash distribution, declare them as library symbols.
> The readline library expects this, so it can set the variables
> accordingly. Maybe you have a version of the library that doesn't have
> them as library symbols?

Indeed that seems to be the case. By "force linking" the
bask-distributed termcap library (by including the termcap library
objects in the list of bash object files), I could silence the need for
BC, PC and UP and build a binary (that crashed).

> 
> If you don't have curses/ncurses/terminfo, you have a couple of options.
> You can compile bash without readline and line editing support by
> running `configure --disable-readline'. If you want to modify the source,
> you can add
> 
> char *BC;
> char *UP;
> char PC;
> 
> to shell.c and see if that works. But if you don't have any termcap or
> ncurses library, the first option is probably the best one.
> 

In fact before I did the "force linking" with termcap I just added those
symbols to builtins/cd.def and that also resulted in a binary that
crashed (which led me to think that they might be doing something
important, so I removed that hack again and proceded with trying to
force termcap to link).

I think your suggestion to disable readline sounds very interesting. I
will for sure try that as my next step and see what that does.

Thanks a lot for your suggestions.

> Chet
> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]