hanslub42 / rlwrap

A readline wrapper
GNU General Public License v2.0
2.53k stars 149 forks source link

configure cannot find readline in non-root install #176

Closed pingouin21 closed 1 year ago

pingouin21 commented 1 year ago

This is a followup from the now-closed #102: the instructions in INSTALL aren't working for a non-root install (--prefix=$HOME/.local/share) on Fedora on a VDI: using CFLAGS/CPPFLAGS of -I$HOME/.local/share/include (where readline-8.2 headers are installed) and LDFLAGS of -L$HOME/.local/share/lib (where shared/static readline libs are installed) still gets me the "You need the GNU readline library...." error message.

hanslub42 commented 1 year ago

I installed readline the way you describe (and made my global readline installation unavailable), but I cannot reproduce this

-I$HOME/.local/share/include (where readline-8.2 headers are installed)

Just guessing, but: the readline headers (like readline.h) should be in $HOME/.local/share/include/readline, and not directly under $HOME/.local/share/include

That might explain your problem. If it doesn't, please reply with config.log attached

pingouin21 commented 1 year ago

rlwrap_config.log.gz

Thank you, and sorry for the gratuitous newlines in the file.

pingouin21 commented 1 year ago

Also: I can confirm that the headers are in $HOME/.local/share/include/readline/

hanslub42 commented 1 year ago

Looking at your config.log, I see that configure doesn't find any of the tinfo, termcap or ncurses (development) libraries.

Therefore, before it prints You need the GNU readline library.... the configure script says: WARNING: No termcap nor curses library found.

This causes the test program that probes for readline() to fail, as linking with libreadline results in:

 libreadline.so: undefined reference to `tputs'

Thius is a bit of a head-scratcher, because the fact that your libreadline refers to tputs means that either tinfo, termcap or ncurses were available when you compiled it.

Anyway, the answer is to install tinfo or to at least add -L and -I flags that point in the right direction.

hanslub42 commented 1 year ago

Looking at readlines tcap.,h it looks like readline will compile just fine without any of the terminal-handling libraries tcap, ncurses, curses or termcap. The resulting library will have undefined symbols for e.g.tgetent, and it is up to the user of libreadline to somehow provide those.

This means that, even though rlwraps term.c provides reasonable fallback definitions for systems without any of the above-mentioned terminal-handling libraries, linking with libreadline will still fail on those systems (like in your case)

So, rlwrap will have to do one of the following two things:

I very much doubt that there exist systems where the lack of a terminal-handling library isn't the result of a mis-configuration (like in your case), but who knows?

Anyway, I choose the first option for the moment (ab95ac11873ea98ef5b72db5a959e1225f9229cc). Closing

pingouin21 commented 1 year ago

Thank you for looking into this, and sorry for my belated reply. I will work on getting this working in my VDI next week.