# [tig] compilation error: undefined reference to `set_tabsize'

9 messages from 2010-09-20 to 2010-09-21. Participants: Nicolas Sebrecht, Stefan Näwe, Jonas Fonseca, Kumar Appaiah, Stefan Naewe.
Thread: https://gitlist.dev/t/25170

## Nicolas Sebrecht, 2010-09-20 17:42

Subject: [tig] compilation error: undefined reference to `set_tabsize'
Message-ID: <20100920174200.GA13017@vidovic>
URL: https://gitlist.dev/e/20100920174200.GA13017%40vidovic

```
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?

-- 
Nicolas Sebrecht

```

## Stefan Näwe, 2010-09-20 18:36

Subject: Re: [tig] compilation error: undefined reference to `set_tabsize'
Message-ID: <loom.20100920T203217-346@post.gmane.org>
URL: https://gitlist.dev/e/loom.20100920T203217-346%40post.gmane.org
In-Reply-To: <20100920174200.GA13017@vidovic>

```
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'
>   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

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

```

## Nicolas Sebrecht, 2010-09-20 20:43

Subject: [tig] Re: compilation error: undefined reference to `set_tabsize'
Message-ID: <20100920204344.GB13017@vidovic>
URL: https://gitlist.dev/e/20100920204344.GB13017%40vidovic
In-Reply-To: <loom.20100920T203217-346@post.gmane.org>

```
The 20/09/10, Stefan Näwe wrote:
> 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'
> >   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
> 
> 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)
  %

-- 
Nicolas Sebrecht

```

## Jonas Fonseca, 2010-09-20 21:48

Subject: Re: [tig] Re: compilation error: undefined reference to `set_tabsize'
Message-ID: <AANLkTin6YnZTyfeKKoUtGvZx8rBvfYDPG98qYa0TXoW9@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTin6YnZTyfeKKoUtGvZx8rBvfYDPG98qYa0TXoW9%40mail.gmail.com
In-Reply-To: <20100920204344.GB13017@vidovic>

```
On Mon, Sep 20, 2010 at 16:43, Nicolas Sebrecht <nicolas.s.dev@gmx.fr> wrote:
> The 20/09/10, Stefan Näwe wrote:
>> 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'
>> >   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
>>
>> 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.

-- 
Jonas Fonseca

```

## Kumar Appaiah, 2010-09-20 23:05

Subject: Re: [tig] Re: compilation error: undefined reference to `set_tabsize'
Message-ID: <20100920230559.GJ23119@bowser.ece.utexas.edu>
URL: https://gitlist.dev/e/20100920230559.GJ23119%40bowser.ece.utexas.edu
In-Reply-To: <20100920204344.GB13017@vidovic>

```
On Mon, Sep 20, 2010 at 10:43:44PM +0200, Nicolas Sebrecht wrote:
> > 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

```

## Kumar Appaiah, 2010-09-20 23:13

Subject: Re: [tig] Re: compilation error: undefined reference to `set_tabsize'
Message-ID: <20100920231349.GK23119@bowser.ece.utexas.edu>
URL: https://gitlist.dev/e/20100920231349.GK23119%40bowser.ece.utexas.edu
In-Reply-To: <20100920230559.GJ23119@bowser.ece.utexas.edu>

```
On Mon, Sep 20, 2010 at 06:05:59PM -0500, Kumar Appaiah wrote:
> On Mon, Sep 20, 2010 at 10:43:44PM +0200, Nicolas Sebrecht wrote:
> > > 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.

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


HTH, Thanks!

Kumar

>From d10b7f15160b7d8da74f899f25018591cb33eec0 Mon Sep 17 00:00:00 2001
From: Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
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(-)

diff --git a/tig.c b/tig.c
index 7bc5daa..01b55d7 100644
--- a/tig.c
+++ b/tig.c
@@ -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")) {
-- 
1.7.2.3

```

## Stefan Naewe, 2010-09-21 06:37

Subject: Re: [tig] Re: compilation error: undefined reference to `set_tabsize'
Message-ID: <loom.20100921T083551-528@post.gmane.org>
URL: https://gitlist.dev/e/loom.20100921T083551-528%40post.gmane.org
In-Reply-To: <20100920231349.GK23119@bowser.ece.utexas.edu>

```
Kumar Appaiah <a.kumar <at> alumni.iitm.ac.in> writes:

> 
> On Mon, Sep 20, 2010 at 06:05:59PM -0500, Kumar Appaiah wrote:
> > 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

```

## Jonas Fonseca, 2010-09-21 12:57

Subject: Re: [tig] Re: compilation error: undefined reference to `set_tabsize'
Message-ID: <AANLkTimvD32iGMwUw6vFhU8Ah+afru-x+opLGsq5Vt1j@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTimvD32iGMwUw6vFhU8Ah%2Bafru-x%2BopLGsq5Vt1j%40mail.gmail.com
In-Reply-To: <loom.20100921T083551-528@post.gmane.org>

```
On Tue, Sep 21, 2010 at 02:37, Stefan Naewe <stefan.naewe@googlemail.com> wrote:
> Kumar Appaiah <a.kumar <at> alumni.iitm.ac.in> writes:
>
>>
>> On Mon, Sep 20, 2010 at 06:05:59PM -0500, Kumar Appaiah wrote:
>> > 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.

Thanks both, patch applied.

-- 
Jonas Fonseca

```

## Nicolas Sebrecht, 2010-09-21 17:34

Subject: [tig] Re: compilation error: undefined reference to `set_tabsize'
Message-ID: <20100921173437.GA13013@vidovic>
URL: https://gitlist.dev/e/20100921173437.GA13013%40vidovic
In-Reply-To: <20100920231349.GK23119@bowser.ece.utexas.edu>

```
The 20/09/10, Kumar Appaiah wrote:
> On Mon, Sep 20, 2010 at 06:05:59PM -0500, Kumar Appaiah wrote:

> > 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)! :-)

-- 
Nicolas Sebrecht

```
