You are not logged in.

#1 2017-10-24 19:36:11

qlem
Member
Registered: 2017-05-09
Posts: 29

ncurses update 6.0+20170902-2 - undefined reference to symbol

Hi,

I have several ncurses programs that not compile after the update 6.0+20170902-2.
Before update, everything was fine.

Here an example code :

#include <ncurses.h>
#include <curses.h>

int     main(void)
{
  initscr();
  keypad(stdscr, TRUE);
  endwin();
  return (0);
}

Generate obj file :

gcc -c foo.c

Compile :

gcc -o foo foo.o -lncurses

Error :

/usr/bin/ld: foo.o: undefined reference to symbol 'keypad'
/usr/lib/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Several ncurses functions generate symbols errors like in the example.
What's wrong ?

Offline

#2 2017-10-24 23:18:25

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,554

Re: ncurses update 6.0+20170902-2 - undefined reference to symbol

and if you add -ltinfo as well?

You really shouldn't be hard-coding these things anyway. That's what pkg-config is for.

Last edited by Scimmia (2017-10-24 23:52:12)

Online

#3 2017-10-25 12:19:16

qlem
Member
Registered: 2017-05-09
Posts: 29

Re: ncurses update 6.0+20170902-2 - undefined reference to symbol

Ok that works with -ltinfo

But i think it is not normal of link that lib for compile ncurses programms. Thanks Scimmia.

Last edited by qlem (2017-10-25 12:56:03)

Offline

#4 2017-10-25 14:17:00

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,554

Re: ncurses update 6.0+20170902-2 - undefined reference to symbol

It definitely is normal; again, see pkg-config

Online

#5 2017-10-25 18:53:59

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: ncurses update 6.0+20170902-2 - undefined reference to symbol

qlem wrote:

Ok that works with -ltinfo

But i think it is not normal of link that lib for compile ncurses programms. Thanks Scimmia.

What isn't normal, is adding -lfoo by hand instead of using pkg-config. That being said, the ncurses maintainer has apparently decided to pander to this usecase and the usecase of a variety of terrible upstreams, by modifying /usr/lib/libncursesw.so to automatically link tinfo at the same time.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB