Skip to content

liblldb.so link failure due to missing -ltinfo flag on systems with split ncurses/tinfo #25067

@llvmbot

Description

@llvmbot
Bugzilla Link 24693
Version 3.7
OS Linux
Attachments patch to LLDBDependencies.cmake to pull in libtinfo if necessary., build log showing cmake invocation, and link command that fails along with error message
Reporter LLVM Bugzilla Contributor
CC @k15tfu

Extended Description

Some systems come with ncurses split into two libraries, libncurses and libtinfo, with symbols divided between the two. This is achieved through the --with-termlib configure flag passed to the ncurses configure script. This is correctly handled in the main llvm cmake scripts (cmake/config-ix.cmake:119) but the lldb one links to only libncurses which results in link failure on such systems with undefined references to:

acs_map
stdscr
halfdelay
curs_set
keypad

These symbols are found in libtinfo.so:

$ nm -D libncurses.so.5.9 | grep -E 'acs_map|stdscr|halfdelay|curs_set|keypad'
                 U acs_map
                 U curs_set
000000000000c780 T is_keypad
                 U _nc_keypad
                 U stdscr
$ nm -D libtinfo.so.5.9 | grep -E 'acs_map|stdscr|halfdelay|curs_set|keypad'
0000000000234a80 B acs_map
0000000000011b60 T curs_set
00000000000119b0 T halfdelay
0000000000011ce0 T keypad
0000000000011c50 T _nc_keypad
0000000000234eb0 B stdscr

The correct way to handle this would be to use pkg-config within cmake which knows which libraries are needed

$ pkg-config ncurses --libs
-lncurses -ltinfo 

but since llvm doesn't seem to rely on pkg-config, an alternative (for which I provide a patch) is to piggyback on what is done within llvm cmake already.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions