2015-04-25 16:05:54

by Sylvain BERTRAND

[permalink] [raw]
Subject: [PATCH] kconfig: add tinfo library if it exists to lxdialog linking flags

HOSTLD scripts/kconfig/mconf
/bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol 'acs_map'

Add tinfo library to lxdiablog linking flags, if it exists.

Signed-off-by: Sylvain BERTRAND <[email protected]>
---
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,6 +4,9 @@
# What library to link
ldflags()
{
+ # Some ncurses symbols are in tinfo library, if it exists
+ pkg-config --libs tinfow 2>/dev/null
+ pkg-config --libs tinfo 2>/dev/null
pkg-config --libs ncursesw 2>/dev/null && exit
pkg-config --libs ncurses 2>/dev/null && exit
for ext in so a dll.a dylib ; do


2015-04-26 21:19:14

by Paul Bolle

[permalink] [raw]
Subject: Re: [PATCH] kconfig: add tinfo library if it exists to lxdialog linking flags

On Sat, 2015-04-25 at 16:05 +0000, [email protected] wrote:
> HOSTLD scripts/kconfig/mconf
> /bin/ld: scripts/kconfig/lxdialog/checklist.o: undefined reference to symbol 'acs_map'
>
> Add tinfo library to lxdiablog linking flags, if it exists.
>
> Signed-off-by: Sylvain BERTRAND <[email protected]>
> ---
> --- a/scripts/kconfig/lxdialog/check-lxdialog.sh
> +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
> @@ -4,6 +4,9 @@
> # What library to link
> ldflags()
> {
> + # Some ncurses symbols are in tinfo library, if it exists
> + pkg-config --libs tinfow 2>/dev/null
> + pkg-config --libs tinfo 2>/dev/null
> pkg-config --libs ncursesw 2>/dev/null && exit
> pkg-config --libs ncurses 2>/dev/null && exit
> for ext in so a dll.a dylib ; do

It looks like commit fc9c6e000f62 ("menuconfig: optionally use
pkg-config to detect ncurses libs") claims to already fix this. And your
patch is obviously done on top of that commit.

So I did some further, well, research. That is: I skimmed man pkg-config
and stared a bit at the pkg-config related files shipped with
ncurses-devel (for Fedora 20). And to me it seems
pkg-config --libs ncursesw

or
pkg-config --libs ncurses

should already add -ltinfow or -ltinfo if those flags would be needed,
just like that commit implies.

Is that how pkg-config should work? If so, I wonder why it fails for
you.

Thanks,


Paul Bolle

2015-04-27 12:00:26

by Sylvain BERTRAND

[permalink] [raw]
Subject: Re: [PATCH] kconfig: add tinfo library if it exists to lxdialog linking flags

On Sun, Apr 26, 2015 at 11:19:08PM +0200, Paul Bolle wrote:
> Is that how pkg-config should work? If so, I wonder why it fails for
> you.

The pkg-config file I use is straight from the ncurses distribution with the
lastest "rollup" patch.

Either it's a fedora specific modification, either a genuine ncurses patch
released after the lastest "rollup" patch.

As far I understand it, from an application point of view, "standard" ncurses
programming, in the case where tinfo lib is outside of ncurses lib, involves
linking to libncurses library only. libtinfo linking would be required only in
some special features are used, which seems to be the case with lxdialog.

Please correct me if I'm wrong.

regards,

--
Sylvain BERTRAND

2015-04-28 08:19:36

by Paul Bolle

[permalink] [raw]
Subject: Re: [PATCH] kconfig: add tinfo library if it exists to lxdialog linking flags

On Mon, 2015-04-27 at 12:00 +0000, [email protected] wrote:
> The pkg-config file I use is straight from the ncurses distribution with the
> lastest "rollup" patch.
>
> Either it's a fedora specific modification, either a genuine ncurses patch
> released after the lastest "rollup" patch.

(If I read ftp://invisible-island.net/ncurses/5.9/README correctly, a
rollup is the patch that should be applied on top of the latest ncurses
release in order to get a development snapshot.)

What version of ncurses are you actually using?

> As far I understand it, from an application point of view, "standard" ncurses
> programming, in the case where tinfo lib is outside of ncurses lib, involves
> linking to libncurses library only. libtinfo linking would be required only in
> some special features are used, which seems to be the case with lxdialog.

On my Fedora 20 box linking to libtinfo is only necessary if you're
linking an application that's using libncurses statically.

> Please correct me if I'm wrong.

I have no idea.

Perhaps - and I'm speculating here - some features got moved from
ncurses(w) to tinfo. Anyhow, over here linking to tinfo is unneeded but
doesn't break mconf as far as I noticed. But, personally, I'd like to
know what triggered the issue you ran into before considering this
patch.


Paul Bolle

2015-04-29 15:20:57

by Sylvain BERTRAND

[permalink] [raw]
Subject: Re: [PATCH] kconfig: add tinfo library if it exists to lxdialog linking flags

Did a little bit of investigation and got in touch with ncurses developer.

The pkg-config file in the official ncurses distribution has been broken for
years (I'm the second one to report this bug since 2011).

acs_map symbol declaration misled me. Then, yes, do disregard my patch.

Since the fix is closed to a typo fix, it has been silently fixed by all
distros out there with a shared split ncurses package, without reporting it
upstream (and that's quite a fail).

At least, the info is now in all mailing list archives :)

regards,

--
Sylvain