Project

General

Profile

Bug #1493

New termcap.h in /usr/include breaks xterm build

Added by Alasdair Lumsden almost 8 years ago. Updated almost 8 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Start date:
2011-09-11
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

This was discovered when building XNV on oi_151 with a recent illumos. The changeset delivered by #1168 delivers a /usr/include/termcap.h, which xterm includes if it can find it. Since xterm also uses ncurses, we get type definition clashes:

ustaining xnv (oi151a.sustaining): open-src/util/build-tools/find-build-errors 
Scanning log/buildit-XW for error messages...

## making install in open-src/app/proxymngr...

checking for style of include used by dmake... GNU
checking for cc option to accept ANSI C... (cached) none needed
checking dependency style of cc... (cached) none
checking for a BSD-compatible install... /export/home/sustaining/build_trees/xnv/open-src/app/proxymngr/../../../open-src/common/install-sh -c
checking for lbxproxy... no
configure: error: lbxproxy is needed
*** Error code 1

------------------------------------------------------------------------------
## making install in open-src/app/xterm...

checking for cc option to accept ANSI C... none needed
checking for an ANSI C-conforming const... yes
checking if SIGWINCH is defined... yes
checking for ncurses/term.h... yes
checking for stdlib.h... yes
checking for sys/ttydefaults.h... no
checking for term.h... yes
checking for termios.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking for nl_langinfo and CODESET... yes
checking for signal global datatype... volatile sig_atomic_t
checking for size_t in <sys/types.h> or <stdio.h>... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... (cached) yes
checking for time_t... yes
checking for mode_t... yes
checking for pid_t... yes
checking for uid_t in sys/types.h... yes
checking for off_t... yes
checking for bcopy... yes
checking for gethostname... yes
checking for getlogin... yes
checking for memmove... yes
checking for putenv... yes
checking for sched_yield... yes
checking for strerror... yes
checking for strftime... yes
checking for tcgetattr... yes
checking for waitpid... yes
checking for wcswidth... yes
checking for wcwidth... yes
checking for memmove... (cached) yes
checking for lastlog.h... yes
checking for paths.h... yes
checking for lastlog path... /usr/adm/lastlog
checking for utmp implementation... utmpx
checking if utmpx.ut_host is declared... yes
checking if utmpx.ut_syslen is declared... yes
checking if utmpx.ut_name is declared... ut_name
checking for exit-status in utmpx... ut_exit.e_exit
checking if utmpx.ut_xtime is declared... yes
checking if utmpx.ut_session is declared... yes
checking if utmpx is SYSV flavor... yes
checking for lastlog.h... (cached) yes
checking for struct lastlog... yes
checking for sys/param.h... yes
checking if POSIX saved-ids are supported... yes
checking if we want full tgetent function... yes
checking for full tgetent function... no
checking for partial tgetent function... -ltermcap
checking for termcap.h... yes
checking for directory to install resource files... /usr/share/X11/app-defaults
checking for directory to install icons... /usr/share/pixmaps
checking if you want to install desktop files... yes
checking for desktop-file-install... yes
checking for install-permissions reference... xterm
checking for xterm... /usr/bin/xterm
checking for symbolic link to create to xterm... xterm
checking if you want to disable setuid... yes
checking if you want to disable setgid... yes
checking if you want to run xterm setuid to a given user... no
checking if you want to run xterm setgid to match utmp/utmpx file... no
checking if you want to link with utempter... no
checking if external errno is declared... yes
checking if external errno exists... yes
checking for explicit tty group name... auto...
checking for tty group name... tty
checking if we may use the tty group... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for POSIX wait functions... yes
checking if external sys_nerr is declared... no
checking if external sys_nerr exists... yes
checking if external sys_errlist is declared... no
checking if external sys_errlist exists... yes
checking for termios.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for X11/Intrinsic.h... yes
checking if we should define SYSV... yes
checking for elf_begin in -lelf... yes
checking if this is an SVR4 system... yes
checking for X... libraries /usr/lib, headers /export/home/sustaining/build_trees/xnv/open-src/app/xterm/../../../proto/root_i386/usr/include
checking whether -R must be followed by a space... no
checking for gethostbyname... no
checking for gethostbyname in -lnsl... yes
checking for connect... no
checking for connect in -lsocket... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking if you want to use pkg-config... yes
checking for pkg-config... /usr/bin/pkg-config
checking for X11/DECkeysym.h... yes
checking for X11/Sunkeysym.h... yes
checking for X11/XF86keysym.h... yes
checking for X11/XKBlib.h... yes
checking for X11/Xpoll.h... yes
checking for X11/extensions/XKB.h... yes
checking if you want to link with Xaw 3d library... no
checking if you want to link with neXT Athena library... no
checking if you want to link with Athena-Plus library... no
checking for X11/Xpoll.h... (cached) yes
checking for declaration of fd_set... sys/types.h
checking for declaration of fd_mask... sys/types.h
checking for IRIX 6.5 baud-rate redefinitions... no
checking for grantpt... yes
checking for XkbQueryExtension... yes
checking for XKB Bell extension... yes
checking for Xutf8LookupString... yes
checking if you want narrow prototypes for X libraries... no
checking if we should use imake to help... no
checking for default terminal-id... vt100
checking for default terminal-type... xterm
checking for tic... yes
checking for private terminfo-directory... /usr/gnu/share/terminfo
checking if you want active-icons... yes
checking if you want ANSI color... yes
checking if you want 16 colors like aixterm... yes
checking if you want 256 colors... yes
checking if you want blinking cursor... yes
checking if you want to ignore Linux's broken palette-strings... no
checking if you want to allow broken string-terminators... yes
checking if you want printable 128-159... yes
checking if you want bold colors mapped like IBM PC... yes
checking if you want separate color-classes... yes
checking if you want color-mode enabled by default... yes
checking if you want support for color highlighting... yes
checking if you want support for doublesize characters... yes
checking if you want fallback-support for box characters... yes
checking if you want to allow spawning new xterms... no
checking if you want to use FreeType library... yes
checking if you specified -D/-I options for FreeType... -I/export/home/sustaining/build_trees/xnv/open-src/app/xterm/../../../proto/root_i386/usr/include -I/export/home/sustaining/build_trees/xnv/open-src/app/xterm/../../../proto/root_i386/usr/include/freetype2
checking if you specified -L/-l options for FreeType... -L/export/home/sustaining/build_trees/xnv/open-src/app/xterm/../../../proto/root_i386/usr/lib -R/usr/lib -lXft -lfontconfig
checking for FreeType config... /usr/bin/pkg-config xft
checking if we can link with FreeType libraries... yes
checking for XftDrawCharSpec... yes
checking for XftDrawSetClip... yes
checking for XftDrawSetClipRectangles... yes
checking if you want support for HP-style function keys... no
checking if you want support for SCO-style function keys... no
checking if you want support for Sun-style function keys... yes
checking if you want saved-lines stored as a FIFO... yes
checking if you want support for internationalization... yes
checking if you want support for initial-erase setup... yes
checking if you want support for input-method... yes
checking if X libraries support input-method... yes
checking if you want support for load-vt-fonts... no
checking if you want support for logging... yes
checking if you want to allow logging via a pipe... no
checking if you want support for iconify/maximize translations... yes
checking if you want NumLock to override keyboard tables... yes
checking if you want support for get/set of base64 selection data... yes
checking if you want support for pty-handshaking... yes
checking if you want support for mouse in readline applications... no
checking if you want support for regular-expression selections... yes
checking if you want to use PCRE for regular-expressions... no
checking for regcomp... yes
checking for regular-expression headers... regex.h
checking if you want support for right-scrollbar... yes
checking if you want check for redundant name-change... yes
checking if you want support for session management... yes
checking if you want to use termcap function-keys... yes
checking if you want to use termcap-query/report... yes
checking if you want support for tek4014... yes
checking if you want pulldown menus with a toolbar... no
checking if you want VT52 emulation... yes
checking if you want to use mini-luit/Latin9 built-in support... no
checking if you want to use luit... yes
checking for /usr/bin/luit... /usr/bin/luit
checking if you want wide-character support... yes
checking if you want only 16-bit character support... no
checking if you want dynamic-abbreviation support... no
checking if you want DECterm Locator support... no
checking if you want VT420 rectangle support... yes
checking if you want -ziconbeep option... yes
checking if you want debugging traces... no
checking if you want to test memory leaks... no
checking if you want to see long compiling messages... no
checking if you want magic cookie emulation... no
checking for tigetstr... no
checking for use_extended_names... no
checking if filesystem supports mixed-case filenames... yes
checking for exctags... no
checking for ctags... ctags
checking for exetags... no
checking for etags... etags
checking for ctags... yes
checking for etags... yes
checking for an rpath option... -R
checking if we need a space after rpath option... no
checking if rpath should be not be set... no
checking for updated LDFLAGS... maybe
checking for ldd... ldd
configure: creating ./config.status
config.status: creating Makefile
config.status: creating xtermcfg.h
(cd build-i386/xterm-261 ; \
 LD_OPTIONS='-L/export/home/sustaining/build_trees/xnv/open-src/app/xterm/../../../proto/root_i386/usr/lib   '  PROTODIR='/export/home/sustaining/build_trees/xnv/open-src/app/xterm/../../../proto/root_i386'  MAKE='dmake'  MKDIRPROG='mkdir -p'    dmake -k -j 16     )
compiling charsets.c
compiling cursor.c
compiling data.c
compiling doublechr.c
compiling linedata.c
compiling cachedGCs.c
compiling ptydata.c
compiling scrollback.c
compiling print.c
compiling xtermcap.c
"/usr/include/ncurses/term.h", line 781: identifier redeclared: tgoto
        current : function(pointer to const char, int, int) returning pointer to char
        previous: function(pointer to char, int, int) returning pointer to char : "/usr/include/termcap.h", line 46
"/usr/include/ncurses/term.h", line 782: identifier redeclared: tgetent
        current : function(pointer to char, pointer to const char) returning int
        previous: function(pointer to char, pointer to char) returning int : "/usr/include/termcap.h", line 42
"/usr/include/ncurses/term.h", line 785: identifier redeclared: tputs
        current : function(pointer to const char, int, pointer to function(..) returning int) returning int
        previous: function(pointer to char, int, pointer to function(..) returning int) returning int : "/usr/include/termcap.h", line 47
cc: acomp failed for ./xtermcap.c
*** Error code 2

------------------------------------------------------------------------------
dmake: Warning: Target `subdirs' not remade because of errors

Current working directory /export/home/sustaining/build_trees/xnv/open-src/app
*** Error code 1

------------------------------------------------------------------------------
dmake: Warning: Target `subdirs' not remade because of errors

Current working directory /export/home/sustaining/build_trees/xnv/open-src
*** Error code 1

------------------------------------------------------------------------------
Build errors: 4
Runtime: 0:18

Gordon Ross asked me to create this issue - it's unclear as of yet whether this needs changes to termcap.h or xterm itself.

History

#1

Updated by Yuri Pankov almost 8 years ago

May be we should make function prototypes in termcap.h compatible with the ones in ncurses - I had problems compiling less (#520) due to third argument of tputs declared as int()(char) - changing it to int()(int) fixed the issue for me...

#2

Updated by Yuri Pankov almost 8 years ago

Stupid redmine formatting, what I mean is:

int(*)(char)   =>   int(*)(int)

#3

Updated by Gordon Ross almost 8 years ago

This is really an xterm bug.

There is no declaration you could put in termcap.h that would be consistent with both the curses and ncurses declarations of tputs. It's more important for the termcap.h declarations to match the curses ones, because those two are more often exposed in the same program. (I know this because I initially had more BSD-like declarations in termcap.h, and lots of 3rd party builds broke.) Programs using ncurses (i.e. xterm) should really be using the termcap.h that ncurses provides; and they would if they did include paths correctly (ncurses includes before system includes).

So this really should be considered "not a defect" for termcap.h, or more correctly, a defect in xterm. That said...

Life would be easier for confused builds like xterm if we could make all of these (termcap, curses, ncurses) agree about the declarations. I looked into that, but gave up because changing the termcap+curses declarations to match ncurses would cause ripples all over the curses code. Probably easier to just fix the include path order in xterm.

#4

Updated by Yuri Pankov almost 8 years ago

Ok.. what about the problem with tputs argument - even curs_terminfo(3X) specifies it as int(*)(int), should I file another ticket about it?

#5

Updated by Yuri Pankov almost 8 years ago

Doh, curs_terminfo(3X) is from ncurses... but still tputs(3CURSES) has:

int tputs(char *str, int affcnt, int (*putc)(char));

while tputs(3XCURSES) has:

int tputs(const char *str, int affcnt, int (*putfunc) (int));

Which one is correct (and why do we have two manpages for the same stuff, telling different things, anyway)?

Alisdair, sorry for hi-jacking your issue....

#6

Updated by Gordon Ross almost 8 years ago

Those are different libraries, each with its own documentation.

You could do the char/int fix for the tputs arg in libcurses, but changing that would not make the declaration consistent with ncurses (they also differ w.r.t. const) so I doubt it's worth the risk of breaking the libcurses code with such a change.

Or, if changing the tputs declaration at all, I'd say fix both the char/int arg and add const where other systems have const args in termcap.h (so we take the risk of changing declarations only once). Just remember, you have to change both termcap.h and term.h and (...) keeping them all consistent.

#7

Updated by Gordon Ross almost 8 years ago

Those are different libraries, each with its own documentation.

And more to the point: xterm is using headers from a different library than the one it links with. That's a problem.

#8

Updated by Rich Lowe almost 8 years ago

is the int v. char mismatch another curses v. ncurses thing, or is that something that could actually be fixed in Gordon's header?

(aside from the char constification)

It's really pretty pathetic that we're breaking things in this manner, whether we think they're "wrong" in some highbrow sense or not they're common, and they used to work

Also available in: Atom PDF