threads / discuss / 25170

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

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

## tl;dr

9 messages between Sep 20, 2010 and Sep 21, 2010.

replies: 8people: 4as markdown or json

Nicolas Sebrecht· Sep 20, 2010, 17:42 UTC · lore
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· Sep 20, 2010, 18:36 UTC · re: Nicolas Sebrecht · lore

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

Nicolas Sebrecht <nicolas.s.dev <at> gmx.fr> writes:
Show 8 quoted lines
> 
> 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'
Show 15 quoted 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
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· Sep 20, 2010, 20:43 UTC · re: Stefan Näwe · lore

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

The 20/09/10, Stefan Näwe wrote:
Show 30 quoted 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'
> >   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· Sep 20, 2010, 21:48 UTC · re: Nicolas Sebrecht · lore

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

On Mon, Sep 20, 2010 at 16:43, Nicolas Sebrecht <nicolas.s.dev@gmx.fr> wrote:
Show 30 quoted lines
> 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· Sep 20, 2010, 23:05 UTC · re: Nicolas Sebrecht · lore

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

On Mon, Sep 20, 2010 at 10:43:44PM +0200, Nicolas Sebrecht wrote:
Show 6 quoted 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
Kumar Appaiah· Sep 20, 2010, 23:13 UTC · re: Kumar Appaiah · lore

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

On Mon, Sep 20, 2010 at 06:05:59PM -0500, Kumar Appaiah wrote:
Show 13 quoted lines
> 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· Sep 21, 2010, 06:37 UTC · re: Kumar Appaiah · lore

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

Kumar Appaiah <a.kumar <at> alumni.iitm.ac.in> writes:
Show 10 quoted lines
> 
> 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· Sep 21, 2010, 12:57 UTC · re: Stefan Naewe · lore

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

On Tue, Sep 21, 2010 at 02:37, Stefan Naewe <stefan.naewe@googlemail.com> wrote:
Show 14 quoted lines
> 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· Sep 21, 2010, 17:34 UTC · re: Kumar Appaiah · lore

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

The 20/09/10, Kumar Appaiah wrote:
> On Mon, Sep 20, 2010 at 06:05:59PM -0500, Kumar Appaiah wrote:
Show 7 quoted lines
> > 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

← back to recent threads