public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Final versions of ncurses libs detection patches
       [not found] <Use config scripts to detect ncurses libs for, menuconfig/nconfig dialogs>
@ 2013-03-06 13:02 ` jlec
  2013-03-06 13:02   ` [PATCH 1/2] menuconfig: optionally use pkg-config to detect ncurses libs jlec
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: jlec @ 2013-03-06 13:02 UTC (permalink / raw)
  To: linux-kbuild, linux-kernel


Hello,

I am sorry for the long delay.
Final versions of the patches which are reduced to the usage of pkg-config. And
if unavailable we use the old code.

Thanks for all suggestions,
Justin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] menuconfig: optionally use pkg-config to detect ncurses libs
  2013-03-06 13:02 ` Final versions of ncurses libs detection patches jlec
@ 2013-03-06 13:02   ` jlec
  2013-03-06 13:02   ` [PATCH 2/2] kconfig: " jlec
  2013-03-06 21:23   ` Final versions of ncurses libs detection patches Yann E. MORIN
  2 siblings, 0 replies; 6+ messages in thread
From: jlec @ 2013-03-06 13:02 UTC (permalink / raw)
  To: linux-kbuild, linux-kernel; +Cc: Justin Lecher

From: Justin Lecher <jlec@gentoo.org>

When building ncurses with --with-termlib several symbols get moved from
libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one
additionally needs to link with libtinfo.so.

The ncurses pkg-config module will be used to detect the necessary libs for
linking. If not available the old heuristic for detection of the ncurses libs
will be used.

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 scripts/kconfig/lxdialog/check-lxdialog.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 8078813..782d200 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,6 +4,8 @@
 # What library to link
 ldflags()
 {
+	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
 		for lib in ncursesw ncurses curses ; do
 			$cc -print-file-name=lib${lib}.${ext} | grep -q /
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] kconfig: optionally use pkg-config to detect ncurses libs
  2013-03-06 13:02 ` Final versions of ncurses libs detection patches jlec
  2013-03-06 13:02   ` [PATCH 1/2] menuconfig: optionally use pkg-config to detect ncurses libs jlec
@ 2013-03-06 13:02   ` jlec
  2013-03-06 20:47     ` Yann E. MORIN
  2013-03-06 21:23   ` Final versions of ncurses libs detection patches Yann E. MORIN
  2 siblings, 1 reply; 6+ messages in thread
From: jlec @ 2013-03-06 13:02 UTC (permalink / raw)
  To: linux-kbuild, linux-kernel; +Cc: Justin Lecher

From: Justin Lecher <jlec@gentoo.org>

When building ncurses with --with-termlib several symbols get moved from
libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one
additionally needs to link with libtinfo.so.

The ncurses pkg-config module will be used to detect the necessary libs for
linking. If not available the old way of directly specifying libs will be
used.

Signed-off-by: Justin Lecher <jlec@gentoo.org>
---
 scripts/kconfig/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 231b475..e76ae5d 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -219,7 +219,9 @@ HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
 
 HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
 
-HOSTLOADLIBES_nconf	= -lmenu -lpanel -lncurses
+HOSTLOADLIBES_nconf	= $(shell \
+				pkg-config --libs menu panel ncurses 2>/dev/null \
+				|| echo "-lmenu -lpanel -ncurses"  )
 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
 
 ifeq ($(qconf-target),1)
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] kconfig: optionally use pkg-config to detect ncurses libs
  2013-03-06 13:02   ` [PATCH 2/2] kconfig: " jlec
@ 2013-03-06 20:47     ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2013-03-06 20:47 UTC (permalink / raw)
  To: linux-kbuild; +Cc: jlec, linux-kernel

Justin, All,

On Wednesday 06 March 2013 jlec@gentoo.org wrote:
> From: Justin Lecher <jlec@gentoo.org>
> 
> When building ncurses with --with-termlib several symbols get moved from
> libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one
> additionally needs to link with libtinfo.so.
> 
> The ncurses pkg-config module will be used to detect the necessary libs for
> linking. If not available the old way of directly specifying libs will be
> used.
> 
> Signed-off-by: Justin Lecher <jlec@gentoo.org>
> ---
>  scripts/kconfig/Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 231b475..e76ae5d 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -219,7 +219,9 @@ HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
>  
>  HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
>  
> -HOSTLOADLIBES_nconf	= -lmenu -lpanel -lncurses
> +HOSTLOADLIBES_nconf	= $(shell \
> +				pkg-config --libs menu panel ncurses 2>/dev/null \
> +				|| echo "-lmenu -lpanel -ncurses"  )

Typo: this should be:  "-lncurses"  and not:  "-ncurses"

I'll fix it here before queuing, no need to resend.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Final versions of ncurses libs detection patches
  2013-03-06 13:02 ` Final versions of ncurses libs detection patches jlec
  2013-03-06 13:02   ` [PATCH 1/2] menuconfig: optionally use pkg-config to detect ncurses libs jlec
  2013-03-06 13:02   ` [PATCH 2/2] kconfig: " jlec
@ 2013-03-06 21:23   ` Yann E. MORIN
  2013-03-07  9:47     ` justin
  2 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2013-03-06 21:23 UTC (permalink / raw)
  To: linux-kbuild; +Cc: jlec, linux-kernel

Justin, All,

On Wednesday 06 March 2013 jlec@gentoo.org wrote:
> I am sorry for the long delay.
> Final versions of the patches which are reduced to the usage of pkg-config. And
> if unavailable we use the old code.

On Ubuntu Quantal, ncurses is indeed compiled with tinfo as a separate
lib, but these two patches are not needed, because libncurses has proper
(NEEDED) on libtinfo:

  $ readelf -d /lib/x86_64-linux-gnu/libncurses.so.5.9 |grep tinfo
  0x0000000000000001 (NEEDED)             Shared library: [libtinfo.so.5]

If I just configure ncurses with:
  $ ./configure --with-termlib --with-shared --without-normal && make
  $ readelf -d lib/libncurses.so.5.9 |grep tinfo
  0x0000000000000001 (NEEDED)             Shared library: [libtinfo.so.5]

I wonder how you configured your ncurses.

But anyway, even in that cse, using pkg-config when available is better
than using our previous legacy checks.

I'm still doing a few more tests on my side before queuing.

> Thanks for all suggestions,

Thanks for staying around during the iterations.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Final versions of ncurses libs detection patches
  2013-03-06 21:23   ` Final versions of ncurses libs detection patches Yann E. MORIN
@ 2013-03-07  9:47     ` justin
  0 siblings, 0 replies; 6+ messages in thread
From: justin @ 2013-03-07  9:47 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: linux-kbuild, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2323 bytes --]

On 06/03/13 22:23, Yann E. MORIN wrote:
> On Ubuntu Quantal, ncurses is indeed compiled with tinfo as a separate
> lib, but these two patches are not needed, because libncurses has proper
> (NEEDED) on libtinfo:
> 
>   $ readelf -d /lib/x86_64-linux-gnu/libncurses.so.5.9 |grep tinfo
>   0x0000000000000001 (NEEDED)             Shared library: [libtinfo.so.5]

Hi Yann,

Same here

$ scanelf -n /lib//libncurses.so.5.9
 TYPE   NEEDED FILE
ET_DYN libc.so.6,libdl.so.2,libtinfo.so.5 /lib//libncurses.so.5.9


But why it works on ubuntu and debian is that

/lib/lib/x86_64-linux-gnu/libncurses.so.5.9

is a ld script with following content

INPUT(libncurses.so.9 -ltinfo)

It instructs the linker at link time to add additionally -ltinfo.

On Gentoo, the base-system maintainers refuse to do this (I would agree
if you call it a bug on our side), but I am not allowed to touch those
packages.

Luckily ncurses provides the config scripts and the pkg-config modules
to do sane linking. This should be done if possible regardless the
situation on a single distributions.

> 
> If I just configure ncurses with:
>   $ ./configure --with-termlib --with-shared --without-normal && make
>   $ readelf -d lib/libncurses.so.5.9 |grep tinfo
>   0x0000000000000001 (NEEDED)             Shared library: [libtinfo.so.5]
> 
> I wonder how you configured your ncurses.

./configure --prefix=/usr --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --mandir=/usr/share/man
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
--localstatedir=/var/lib --libdir=/usr/lib64
--with-terminfo-dirs=/etc/terminfo:/usr/share/terminfo --with-shared
--without-hashed-db --without-ada --with-cxx --with-cxx-binding
--without-debug --without-profile --with-gpm --disable-termcap
--enable-symlinks --with-rcs-ids --with-manpage-format=normal
--enable-const --enable-colorfgbg --enable-echo --enable-pc-files
--enable-warnings --without-assertions --disable-leaks
--without-expanded --with-macros --without-trace --with-termlib
--with-chtype=long --with-mmask-t=long --disable-ext-colors
--disable-ext-mouse --without-pthread --without-reentrant

> 
> Thanks for staying around during the iterations.

No problem, this is how it works. Thanks for your suggestions,

Justin



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-07  9:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Use config scripts to detect ncurses libs for, menuconfig/nconfig dialogs>
2013-03-06 13:02 ` Final versions of ncurses libs detection patches jlec
2013-03-06 13:02   ` [PATCH 1/2] menuconfig: optionally use pkg-config to detect ncurses libs jlec
2013-03-06 13:02   ` [PATCH 2/2] kconfig: " jlec
2013-03-06 20:47     ` Yann E. MORIN
2013-03-06 21:23   ` Final versions of ncurses libs detection patches Yann E. MORIN
2013-03-07  9:47     ` justin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox