Skip to contentSkip to conversation

compilation error: undefined reference to `set_tabsize'

tig Nicolas Sebrecht 4 participants 9 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

tig don't compile anymore here:

% make
gcc tig.o -lncursesw -o tig
tig.o: In function init_display': tig.c:7113: undefined reference to set_tabsize'
collect2: ld returned 1 exit status
make: *** [tig] Error 1
%

and bisected on

commit f1fe753be71ef3ce5abcbb16c2a359f97e5c7e7d

Author: Stefan Naewe <>
Date:   Sun Sep 12 11:03:52 2010 +0200

Use function set_tabsize()

this fixes the following compile error on cygwin:
tig.c: In function `init_display':
tig.c:7112: error: invalid lvalue in assignment

Signed-off-by Stefan Naewe <>
Signed-off-by Jonas Fonseca <>

Or did I missed something?

Signature · 1 line
Nicolas Sebrecht
#1 lore raw
Quoted 8 lines · Nicolas Sebrecht <nicolas.s.dev <at> gmx.fr> writes:

Hi,

tig don't compile anymore here:

% make
gcc tig.o -lncursesw -o tig
tig.o: In function `init_display': tig.c:7113: undefined reference to

`set_tabsize'

Quoted 7 lines

collect2: ld returned 1 exit status
make: *** [tig] Error 1
%

and bisected on

commit f1fe753be71ef3ce5abcbb16c2a359f97e5c7e7d

Quoted 8 lines
Author: Stefan Naewe <>
Date:   Sun Sep 12 11:03:52 2010 +0200

Use function set_tabsize()

this fixes the following compile error on cygwin:
tig.c: In function `init_display':
tig.c:7112: error: invalid lvalue in assignment

That change works for me on Cygwin, Ubuntu 10.04, Debian 5.0.6

Maybe you should say something about your system/OS version ?

Regards,

Stefan

#2 lore raw
Quoted 23 lines · Stefan Näwe
Quoted 8 lines · Nicolas Sebrecht <nicolas.s.dev <at> gmx.fr> writes:

Hi,

tig don't compile anymore here:

% make
gcc tig.o -lncursesw -o tig
tig.o: In function `init_display': tig.c:7113: undefined reference to

`set_tabsize'

Quoted 12 lines

collect2: ld returned 1 exit status
make: *** [tig] Error 1
%

and bisected on

commit f1fe753be71ef3ce5abcbb16c2a359f97e5c7e7d

Author: Stefan Naewe <>
Date:   Sun Sep 12 11:03:52 2010 +0200

Use function set_tabsize()

Quoted 7 lines
Quoted 3 lines

this fixes the following compile error on cygwin:
tig.c: In function `init_display':
tig.c:7112: error: invalid lvalue in assignment

That change works for me on Cygwin, Ubuntu 10.04, Debian 5.0.6

Maybe you should say something about your system/OS version ?

Naturally. I'm running on Gentoo.

  % gcc -v
  Using built-in specs.
  Target: x86_64-pc-linux-gnu
  Configured with:
  /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure
  --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2
  --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include
  --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2
  --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man
  --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/info
  --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4
  --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
  --enable-nls --without-included-gettext --with-system-zlib
  --disable-checking --disable-werror --enable-secureplt --enable-multilib
  --enable-libmudflap --disable-libssp --enable-java-awt=gtk
  --enable-languages=c,c++,java,treelang,fortran --enable-shared
  --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
  Thread model: posix
  gcc version 4.1.2 (Gentoo 4.1.2 p1.3)
  %
Signature · 1 line
Nicolas Sebrecht
#3 lore raw
Quoted 6 lines · Nicolas Sebrecht
Quoted 3 lines

That change works for me on Cygwin, Ubuntu 10.04, Debian 5.0.6

Maybe you should say something about your system/OS version ?

Naturally. I'm running on Gentoo.

Ack that this also breaks build on CentOS. The simple reason is that the ncurses version on CentOS 5.5 is ncurses-5.5, while that on Debian Lenny is 5.7+. According to the changelog, 5.6 onwards has set_tabsize, so checking for that version of ncurses might be a good option.

Thanks.

Kumar

#4 lore raw
Quoted 5 lines · Kumar Appaiah
Quoted 4 lines · Nicolas Sebrecht
Quoted 3 lines

That change works for me on Cygwin, Ubuntu 10.04, Debian 5.0.6

Maybe you should say something about your system/OS version ?

Quoted 8 lines
Quoted 2 lines

Naturally. I'm running on Gentoo.

Ack that this also breaks build on CentOS. The simple reason is that the ncurses version on CentOS 5.5 is ncurses-5.5, while that on Debian Lenny is 5.7+. According to the changelog, 5.6 onwards has set_tabsize, so checking for that version of ncurses might be a good option.

I have attached a patch which uses the patch number to determine this:

HTH, Thanks!

Kumar

Quoted 1 line

From d10b7f15160b7d8da74f899f25018591cb33eec0 Mon Sep 17 00:00:00 2001

From: Kumar Appaiah <[email protected]>
Date: Mon, 20 Sep 2010 18:10:11 -0500
Subject: [PATCH] Check the ncurse version before using set_tabsize

This patch checks the ncurses patch level to decide if set_tabsize is to be used in place of the TABSIZE macro, for setting the tab size.

---
 tig.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tig.c +4 -0
index 7bc5daa..01b55d7 100644
@@ -7111,7 +7111,11 @@ init_display(void)
 	keypad(status_win, TRUE);
 	wbkgdset(status_win, get_line_attr(LINE_STATUS));
 
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20080119)
 	set_tabsize(opt_tab_size);
+#else
+	TABSIZE = opt_tab_size;
+#endif
 
 	term = getenv("XTERM_VERSION") ? NULL : getenv("COLORTERM");
 	if (term && !strcmp(term, "gnome-terminal")) {
Signature · 1 line
1.7.2.3
#5 lore raw
Quoted 9 lines · Kumar Appaiah
Quoted 5 lines · Kumar Appaiah

Ack that this also breaks build on CentOS. The simple reason is that the ncurses version on CentOS 5.5 is ncurses-5.5, while that on Debian Lenny is 5.7+. According to the changelog, 5.6 onwards has set_tabsize, so checking for that version of ncurses might be a good option.

I have attached a patch which uses the patch number to determine this:

Thanks Kumar, it did it (with ncurses v5.6)! :-)

Signature · 1 line
Nicolas Sebrecht
#6 lore raw
In reply to Kumar Appaiah
Quoted 10 lines · Kumar Appaiah <a.kumar <at> alumni.iitm.ac.in> writes:
Quoted 5 lines · Kumar Appaiah

Ack that this also breaks build on CentOS. The simple reason is that the ncurses version on CentOS 5.5 is ncurses-5.5, while that on Debian Lenny is 5.7+. According to the changelog, 5.6 onwards has set_tabsize, so checking for that version of ncurses might be a good option.

I have attached a patch which uses the patch number to determine this:

Good. Works for me on Debian 5.0.6 and Cygwin.

Regards,

Stefan

#7 lore raw
Quoted 10 lines · Stefan Naewe
Quoted 8 lines · Kumar Appaiah <a.kumar <at> alumni.iitm.ac.in> writes:
Quoted 5 lines · Kumar Appaiah

Ack that this also breaks build on CentOS. The simple reason is that the ncurses version on CentOS 5.5 is ncurses-5.5, while that on Debian Lenny is 5.7+. According to the changelog, 5.6 onwards has set_tabsize, so checking for that version of ncurses might be a good option.

Quoted 4 lines
Quoted 2 lines

I have attached a patch which uses the patch number to determine this:

Good. Works for me on Debian 5.0.6 and Cygwin.

Thanks both, patch applied.

Signature · 1 line
Jonas Fonseca
#8 lore raw
In reply to Nicolas Sebrecht
Quoted 25 lines · Nicolas Sebrecht
Quoted 24 lines · Stefan Näwe
Quoted 5 lines · Nicolas Sebrecht <nicolas.s.dev <at> gmx.fr> writes:

tig don't compile anymore here:

  % make
  gcc   tig.o  -lncursesw  -o tig
  tig.o: In function `init_display': tig.c:7113: undefined reference to

`set_tabsize'

Quoted 15 lines

  collect2: ld returned 1 exit status
  make: *** [tig] Error 1
  %

and bisected on

commit f1fe753be71ef3ce5abcbb16c2a359f97e5c7e7d
Author: Stefan Naewe <>
Date:   Sun Sep 12 11:03:52 2010 +0200

    Use function set_tabsize()

    this fixes the following compile error on cygwin:
    tig.c: In function `init_display':
    tig.c:7112: error: invalid lvalue in assignment

Quoted 5 lines
Quoted 3 lines

That change works for me on Cygwin, Ubuntu 10.04, Debian 5.0.6

Maybe you should say something about your system/OS version ?

Naturally. I'm running on Gentoo.

One possibility is to add a check to configure, but I don't know if you are even using that. Alternatively, I think it would also be safe to simply just delete the line in question, since tig expands all tabs to strings since quite a few releases.

Signature · 1 line
Jonas Fonseca