zsh-workers
 help / color / Atom feed
* [PATCH] configure.ac: check for has_colors symbol in curses lib
@ 2019-12-11 15:55 Lars Wendler
  2020-04-25  9:49 ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Wendler @ 2019-12-11 15:55 UTC (permalink / raw)
  To: zsh-workers; +Cc: Lars Wendler, Tetja Rediske

Otherwise zsh/curses module won't get built if ncurses was built with
separate tinfo lib.
One could still force-build the module but loading it later yields the
following error message:

  failed to load module `zsh/curses': /usr/lib64/zsh/5.7.1/zsh/curses.so:
  undefined symbol: COLORS

That is because the final linker call requires -lncurses(w) but it only
contains -ltinfo(w).

Reported-by: Tetja Rediske <tetja@tetja.de>
See-also: http://www.zsh.org/mla/users/2016/msg01097.html
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 8fd4d452f..9623133f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -816,6 +816,7 @@ AC_SEARCH_LIBS(tgetent, [$termcap_curses_order],
 This is probably a library called 'curses' or 'ncurses'.  You may
 need to install a package called 'curses-devel' or 'ncurses-devel' on your
 system."], 255))
+AC_SEARCH_LIBS(has_colors, [$termcap_curses_order])
 AC_CHECK_HEADERS(curses.h, [],
 [AC_CACHE_CHECK(for Solaris 8 curses.h mistake, ac_cv_header_curses_solaris,
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[]])],[ac_cv_header_curses_h=yes
-- 
2.24.1


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

* Re: [PATCH] configure.ac: check for has_colors symbol in curses lib
  2019-12-11 15:55 [PATCH] configure.ac: check for has_colors symbol in curses lib Lars Wendler
@ 2020-04-25  9:49 ` Daniel Shahaf
  2020-04-25 10:24   ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2020-04-25  9:49 UTC (permalink / raw)
  To: Lars Wendler; +Cc: zsh-workers, Tetja Rediske

Lars Wendler wrote on Wed, 11 Dec 2019 16:55 +0100:
> Otherwise zsh/curses module won't get built if ncurses was built with
> separate tinfo lib.
> One could still force-build the module but loading it later yields the
> following error message:
> 
>   failed to load module `zsh/curses': /usr/lib64/zsh/5.7.1/zsh/curses.so:
>   undefined symbol: COLORS
> 
> That is because the final linker call requires -lncurses(w) but it only
> contains -ltinfo(w).
> 

I can't reproduce the problem.

I'm on Debian buster.  The ncurses package is built with «--with-termlib=tinfo».
On my system libncursesw.so.6 and libtinfo.so.6 are both installed, and
the function «has_colors» is provided by libncursesw.so.6.  However, on
my machine the zsh/curses module is built successfully and the
tetriscurses function (in the zsh distribution) works — in plain
master, without your patch.

I build with:

    CONFIG_SHELL=/bin/dash /path/to/zsh/configure -q --enable-zsh-debug --with-term-lib="tinfo" --prefix=…
    perl -pi -e 's/link=dynamic/link=static/g; if (/link=static/) { s/auto=yes/auto=no/ }' config.modules

HTH,

Daniel

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

* Re: [PATCH] configure.ac: check for has_colors symbol in curses lib
  2020-04-25  9:49 ` Daniel Shahaf
@ 2020-04-25 10:24   ` Daniel Shahaf
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2020-04-25 10:24 UTC (permalink / raw)
  To: Lars Wendler; +Cc: zsh-workers, Tetja Rediske

Daniel Shahaf wrote on Sat, 25 Apr 2020 09:49 +0000:
> Lars Wendler wrote on Wed, 11 Dec 2019 16:55 +0100:
> > Otherwise zsh/curses module won't get built if ncurses was built with
> > separate tinfo lib.
> > One could still force-build the module but loading it later yields the
> > following error message:
> > 
> >   failed to load module `zsh/curses': /usr/lib64/zsh/5.7.1/zsh/curses.so:
> >   undefined symbol: COLORS
> > 
> > That is because the final linker call requires -lncurses(w) but it only
> > contains -ltinfo(w).
> >   
> 
> I can't reproduce the problem.
> 
> I'm on Debian buster.  The ncurses package is built with «--with-termlib=tinfo».
> On my system libncursesw.so.6 and libtinfo.so.6 are both installed, and
> the function «has_colors» is provided by libncursesw.so.6.  However, on
> my machine the zsh/curses module is built successfully and the
> tetriscurses function (in the zsh distribution) works — in plain
> master, without your patch.
> 
> I build with:
> 
>     CONFIG_SHELL=/bin/dash /path/to/zsh/configure -q --enable-zsh-debug --with-term-lib="tinfo" --prefix=…
>     perl -pi -e 's/link=dynamic/link=static/g; if (/link=static/) { s/auto=yes/auto=no/ }' config.modules

Relevant config.log excerpt:

[[[
configure:6182: checking for clock_gettime in -lrt
configure:6207: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -lrt  -lm  -lc >&5
configure:6207: $? = 0
configure:6216: result: yes
configure:6241: checking for library containing tigetstr
configure:6272: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -lrt -lm  -lc >&5
/usr/bin/ld: /tmp/conftest-e1b3ec.o: in function `main':
/tmp/zsh/conftest.c:91: undefined reference to `tigetstr'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:6272: $? = 1
configure: failed program was:
configure:6272: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo  -lrt -lm  -lc >&5
configure:6272: $? = 0
configure:6289: result: -ltinfo
configure:6313: checking if _XOPEN_SOURCE_EXTENDED should not be defined
configure:6327: result: no
configure:6335: checking for library containing tigetstr
configure:6383: result: -ltinfo
configure:6391: checking for library containing tigetflag
configure:6422: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo -ltinfo -lrt -lm  -lc >&5
configure:6422: $? = 0
configure:6439: result: none required
configure:6447: checking for library containing tgetent
configure:6478: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo -ltinfo -lrt -lm  -lc >&5
configure:6478: $? = 0
configure:6495: result: none required
configure:6513: checking curses.h usability
configure:6513: cc -c  -Wall -Wmissing-prototypes -ggdb  conftest.c >&5
configure:6513: $? = 0
configure:6513: result: yes
configure:6513: checking curses.h presence
configure:6513: cc -E  conftest.c
configure:6513: $? = 0
configure:6513: result: yes
configure:6513: checking for curses.h
configure:6513: result: yes
configure:6556: checking if we need to ignore ncurses
configure:6574: checking for library containing tigetstr
configure:6605: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo -lrt -lm  -lc >&5
configure:6605: $? = 0
configure:6622: result: none required
configure:6630: checking for library containing tigetnum
configure:6661: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo -lrt -lm  -lc >&5
configure:6661: $? = 0
configure:6678: result: none required
configure:6686: checking for library containing tigetflag
configure:6717: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo -lrt -lm  -lc >&5
configure:6717: $? = 0
configure:6734: result: none required
configure:6742: checking for library containing tgetent
configure:6773: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo -lrt -lm  -lc >&5
configure:6773: $? = 0
configure:6790: result: none required
configure:6811: checking for library containing initscr
configure:6842: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -ltinfo -ltinfo -lrt -lm  -lc >&5
/usr/bin/ld: /tmp/conftest-b582c6.o: in function `main':
/tmp/zsh/conftest.c:92: undefined reference to `initscr'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:6842: $? = 1
configure:6842: cc -o conftest  -Wall -Wmissing-prototypes -ggdb  -g conftest.c -lncursesw  -ltinfo -ltinfo -lrt -lm  -lc >&5
configure:6842: $? = 0
configure:6859: result: -lncursesw
configure:6879: result: no
configure:6882: checking for library containing getpwnam
]]]


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 15:55 [PATCH] configure.ac: check for has_colors symbol in curses lib Lars Wendler
2020-04-25  9:49 ` Daniel Shahaf
2020-04-25 10:24   ` Daniel Shahaf

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git