Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

sys-libs/ncurses & Using ncurses6-config

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
1 post • Page 1 of 1
Author
Message
jlpoole
Guru
Guru
User avatar
Posts: 495
Joined: Tue Nov 01, 2005 5:07 am
Location: Salem, OR

sys-libs/ncurses & Using ncurses6-config

  • Quote

Post by jlpoole » Thu May 16, 2024 5:10 pm

I was trying to build in Gentoo an open source project readsb which converts radio signals emitted by aircraft into information packets used to track aircraft. I ran into this error during the build process:

Code: Select all

    cd /usr/local/src
    sudo chmod 777 .
    git clone https://github.com/wiedehopf/readsb.git
    cd readsb
    make
    ...
       cc -o readsb readsb.o argp.o anet.o interactive.o mode_ac.o mode_s.o comm_b.o json_out.o net_io.o crc.o demod_2400.o uat2esnt/uat2esnt.o uat2esnt/uat_decode.o stats.o cpr.o icao_filter.o track.o util.o fasthash.o convert.o sdr_ifile.o sdr_beast.o sdr.o ais_charset.o globe_index.o geomag.o receiver.o aircraft.o api.o minilzo.o threadpool.o  -pthread -lpthread -lm -lrt -lzstd -lz -lncurses
    /usr/libexec/gcc/x86_64-pc-linux-gnu/ld: interactive.o: undefined reference to symbol 'stdscr'
    /usr/libexec/gcc/x86_64-pc-linux-gnu/ld: /lib64/libtinfo.so.6: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:158: readsb] Error 1
I did not know precisely what the error meant other than it looks to be relating to an attempt to link the previously compiled objects. I did find within the code that "stdscr" was referenced and I determined that "stdscr" within ncurses is:

Code: Select all

    The Standard Screen
	Upon initializing curses, a default window called stdscr, which is the size of the terminal screen, is created. Many curses functions use this window. 
    
    Source: https://manpages.org/stdscr/3
So I looked for the symbol in the library libncurses on my Gentoo workstation:

Code: Select all

		jlpoole@ryzdesk /usr/local/src/readsb $ nm -gD /lib64/libncurses.so.6.4 |nl|grep stdscr
		311  0000000000014af0 T _nc_stdscr_of
		428                   U stdscr
		jlpoole@ryzdesk /usr/local/src/readsb $ 
Note: the tool I used is "nm",aka "Name Mangling". See https://en.wikipedia.org/wiki/Nm_(Unix)


I also tried building the project on Debian and I succeeded. So I compared the search for the symbol on both systems:

On the Rpi4:

Code: Select all

	jlpoole@adsbDEV:/run/readsb $ nm -gD /usr/lib/arm-linux-gnueabihf/libncurses.so.6.2 |grep stdscr
		U stdscr@NCURSES6_TINFO_5.0.19991023
		jlpoole@adsbDEV:/run/readsb $ nm -gD /usr/lib/arm-linux-gnueabihf/libncurses.so.6 |grep stdscr
		U stdscr@NCURSES6_TINFO_5.0.19991023
		jlpoole@adsbDEV:/run/readsb $

On Debian:

Code: Select all

    jlpoole@debian1:~$ nm -gD /usr/lib/x86_64-linux-gnu/libncursesw.so.6.4 |grep stdscr
                 U stdscr@NCURSES6_TINFO_5.0.19991023
    jlpoole@debian1:~$ 
Gnu's nm tells me "U" is a symbol type meaning: "The symbol is undefined." But in the Raspian and Debian image, there is something more, e.g. "@...", than what was in Gentoo's library.

As I searched around, I read somewhere that ncurses may be compiled into two libraries and after scouring my Gentoo system with:

Code: Select all

locate "*ncurs*"

I discovered the tool "ncurses6-config" which I was not familiar with. I learned one of the options, i.e. "--libs", revealed a query which "echos the libraries needed to link with ncurses". The output below shows that "-ltinfo" was listed, so I tried adding at the end " -ltinfo" to the linker command of the failing command line and the linker successfully created the object file and the "make" continued. What was needed was to specify the inclusion of libraray "tinfo" (/lib64/libtinfo.so.6.4).

Code: Select all

    jlpoole@ryzdesk /usr/local/src/readsb $ /usr/bin/ncurses6-config
    Usage: ncurses6-config [options]

    Options:
    --prefix           echos the package-prefix of ncurses
    --exec-prefix      echos the executable-prefix of ncurses

    --cflags           echos the C compiler flags needed to compile with ncurses
    --libs             echos the libraries needed to link with ncurses

    ...
    jlpoole@ryzdesk /usr/local/src/readsb $ /usr/bin/ncurses6-config --libs
    -L/usr/lib64 -lncurses -ltinfo
    jlpoole@ryzdesk /usr/local/src/readsb $ cc -o readsb readsb.o argp.o anet.o interactive.o mode_ac.o mode_s.o comm_b.o json_out.o net_io.o crc.o demod_2400.o uat2esnt/uat2esnt.o uat2esnt/uat_decode.o stats.o cpr.o icao_filter.o track.o util.o fasthash.o convert.o sdr_ifile.o sdr_beast.o sdr.o ais_charset.o globe_index.o geomag.o receiver.o aircraft.o api.o minilzo.o threadpool.o -pthread -lpthread -lm -lrt -lzstd -lz -lncurses -ltinfo
    jlpoole@ryzdesk /usr/local/src/readsb $ make
    rm -f viewadsb
    cp readsb viewadsb
    jlpoole@ryzdesk /usr/local/src/readsb $

So, if people run into a problem with unsupported packages not compiling because of error messages above, then if there is a hint the problem is related to ncurses, the above may prove helpful in overcoming the problem.
Top
Post Reply
1 post • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy