Summary:ASTERISK-20687: make menuselect fails on asterisk 1.8 due to unreferenced linker lib -ltinfo
Reporter:Richard Hamnett (rhamnett)Labels:
Date Opened:2012-11-15 10:21:51.000-0600Date Closed:2018-01-02 08:36:10.000-0600
Versions: 13.18.4 Frequency of
Environment:Attachments:( 0) config.log
# make menuselect
CC="cc" CXX="" LD="" AR="" RANLIB="" CFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" makeopts
make[1]: Entering directory `/root/asterisk-'
make[1]: `makeopts' is up to date.
make[1]: Leaving directory `/root/asterisk-'
CC="cc" CXX="" LD="" AR="" RANLIB="" CFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" cmenuselect
make[1]: Entering directory `/root/asterisk-'
gcc  -o cmenuselect menuselect.o strcompat.o menuselect_curses.o mxml/libmxml.a -lncurses
/usr/bin/ld: menuselect_curses.o: undefined reference to symbol 'keypad'
/usr/bin/ld: note: 'keypad' is defined in DSO /lib64/libtinfo.so.5 so try adding it to the linker command line
/lib64/libtinfo.so.5: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[1]: *** [cmenuselect] Error 1
make[1]: Leaving directory `/root/asterisk-'
make: *** [menuselect/cmenuselect] Error 2

To fix, I edited menuselect/Makefile and changed the line from



 C_LIBS +=$(NCURSES_LIB) -ltinfo

I am on Amazon Linux AMI release 2012.09

Seems that the configure does not correctly include the -ltinfo into the NCURSES_LIB variable.
Comments:By: Michael L. Young (elguero) 2012-11-15 16:21:18.261-0600

Do you have ncurses-devel package installed?

Please attach your config.log.

By: Richard Hamnett (rhamnett) 2012-11-15 16:26:48.886-0600

Hi, of course:

# rpm -qa |grep curses
# rpm -qa |grep term

Attaching config.log now

By: Richard Hamnett (rhamnett) 2012-11-15 16:28:25.147-0600

Attached config.log with hostname removed

By: Richard Hamnett (rhamnett) 2012-11-15 16:38:22.978-0600

I suppose I should clarify that my change to the menuselect Makefile does indeed allow me to get into the curses interface properly and everything then works. I had not clarified that in the original report.

By: Michael L. Young (elguero) 2012-11-15 21:57:29.820-0600

Can you run "nm -D /lib64/libncurses.so.5 | grep keypad" and give the output?  Just trying to figure out why you needed to link directly to libtinfo.

By: Richard Hamnett (rhamnett) 2012-11-19 11:12:29.098-0600

Hi this bug is still in state 'waiting for feedback' but I have provided what you asked for.



By: Richard Hamnett (rhamnett) 2012-11-19 11:20:30.614-0600

Sorry! Somehow my reply didn't get posted:

# nm -D /lib64/libncurses.so.5 | grep keypad
                U _nc_keypad
000000000000a970 T is_keypad

By: Richard Hamnett (rhamnett) 2012-11-21 19:51:55.305-0600

Do you need anything more from me?

By: Matt Jordan (mjordan) 2012-11-22 08:28:48.439-0600

I don't think we want to always link the tinfo library, as its only created when the {{--with-termlib=tinfo}} option is specified when ncurses is built.  The fact that this is - so far - only a problem on an Amazon Linux distro makes it likely that forcing the library will result in problems for other distros.

A quick [Google search|http://www.mail-archive.com/util-linux-ng@vger.kernel.org/msg00273.html] turned up a similar problem on the util-linux package, with a potential way of modifying the configure script to properly link in the {{tinfo}} library.

If you'd like to provide a patch that modifies the {{configure}} script to handle this scenario that'd be appreciated.

By: Richard Hamnett (rhamnett) 2012-11-26 13:24:40.480-0600

Hi, can do that. Will keep you posted.

By: Richard Hamnett (rhamnett) 2012-11-26 13:43:49.928-0600

Hi the configure scripts are somewhat different to what I am used to. It will take me some time to understand what needs to be done. Perhaps someone can do this more efficiently? Anyway I will see what I can do with the limited time available.


By: Corey Farrell (coreyfarrell) 2017-12-19 07:50:09.906-0600

Is this still an issue with current Amazon cloud service?  I believe the Amazon build of ncurses is/was broken.  See the following output from both Fedora 26 and CentOS 7:
$ ldd /usr/lib64/libncurses.so.*.*
linux-vdso.so.1 (0x00007ffca2f3a000)
libc.so.6 => /lib64/libc.so.6 (0x00007ff6e1804000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ff6e1600000)
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007ff6e13d4000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff6e1e01000)

In addition if I create a C program source mytest.c with a minimal main() function and run the following:
$ gcc mytest.c -o mytest -lncurses
$ ldd mytest
linux-vdso.so.1 (0x00007ffc267b7000)
libncurses.so.6 => /lib64/libncurses.so.6 (0x00007fe3c6d1c000)
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fe3c6af0000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe3c671b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fe3c6517000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe3c6f44000)

As you can see linking with {{-lncurses}} caused my linker to implicitly include {{-ltinfo}} because ncurses requires it.  I believe the fact that Amazon did not do this was a bug in Amazon Linux, not Asterisk.

By: Asterisk Team (asteriskteam) 2018-01-02 08:36:10.393-0600

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].
[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines