delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/03/11:28:17

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49AD5A87.1010506@cwilson.fastmail.fm>
Date: Tue, 03 Mar 2009 11:27:51 -0500
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.25-15: First steps with ncurses programming: can NOT build Hello_world app
References: <557426 DOT 1341 DOT qm AT web33206 DOT mail DOT mud DOT yahoo DOT com>
In-Reply-To: <557426.1341.qm@web33206.mail.mud.yahoo.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Alexey Lyubimov wrote:
> Unfortunately, things went worse :-(
> After I've upgraded to GCC 3.4.4-999 and libncurses9-5.7-2 I get the following error instead of a ld's warning (see my first message in this thread for the reference):
> 
> $ gcc -otnc -g -Wl,--enable-auto-import tnc.c -lncurses
> /cygdrive/c/windows/temp/ccUqygVy.o: In function `main':
> /cygdrive/e/home/ael/work/ncurses/tnc.c:15: undefined reference to `_stdscr'
> collect2: ld returned 1 exit status

The only way this could've happened is if you compiled tnc.c with the
5.5-3 headers (that is, the ones matching libncurses8) but tried to link
against libncurses9 (e.g. 5.7-1, 5.7-2, or 5.7-3).  However, because the
link libraries and header files are all distributed together in one
package (libncurses-devel), AND because you compiled and linked all at
once in the same command, I'm at a loss to explain what happened.

FYI, for ease of diagnosing build failures like this, I usually -- even
when an app consists of only a single source file -- compile and link in
separate steps:

$ gcc -g -o tnc.o -c tnc.c
$ gcc -Wl,--enable-auto-import -o tnc tnc.o -lncurses

My first guess, with 5.7-1 and 5.7-2, but not 5.7-3, would be that the
stdscr symbol has moved from the ncurses library to the tinfo library,
so you needed to link using '-lncurses -ltinfo'.  BUT, in the 5.7
versions of ncurses, that symbol is no longer named _stdscr (you use
stdscr in YOUR code, but the ncurses.h header magic turns it into
ncwrap_stdscr() behind your back).  So, if THAT were the problem, you'd
have seen "...tnc.c:15: undefined reference to `_ncwrap_scdstr'" once
you got to the linker stage.

In any case, the tinfo library has been re-merged back into the main
ncurses library with the release of 5.7-3/5.7-12.

So, my recommendation in any case would have been to upgrade to
ncurses-5.7-3 once it propagated to the mirrors. So, I'm glad that fixed
the problem for you.

Sorry for the trouble.

--
Chuck

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019