Subject: Re: Problem with compiling Perl Curses.pm
From: Reini Urban <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Tue, 19 Jan 2010 15:36:53 +0100
List-Id: <cygwin.cygwin.com>

2010/1/19 Jurgen Defurne:
> I am beginning to upgrade my environment to Cygwin 1.7. Since I have a
> whole lot of extra requirements, especially in the realm of Perl, I
> have a test case to check my software against.
>
> Well, the second package I want to add is Perl Curses.pm, which does
> not compile anymore. I get
>
> CursesVar.c: In function â€˜XS_Curses_Vars_STOREâ€™:
> CursesVar.c:190: error: lvalue required as left operand of assignment
> CursesVar.c:197: error: lvalue required as left operand of assignment
> CursesVar.c:204: error: lvalue required as left operand of assignment
> CursesVar.c:211: error: lvalue required as left operand of assignment
> CursesVar.c:218: error: lvalue required as left operand of assignment
> CursesVar.c:225: error: lvalue required as left operand of assignment
>
> When I expand CursesVar with inclusion of ncurses.h, I see something like this :
>
> XS(XS_Curses_Vars_STORE)
> {
>    dXSARGS;
>    {
>  int num = (int)SvIV((SV*)SvRV(ST(0)));
>
>  switch (num) {
>  case 1:
>
>     ncwrap_LINES() = (int)SvIV(ST(1));
>
>>>> Which indeed looks wrong, since the LHS of the assignment is a
>>>> function call.

I can reproduce it
First we got at CursesVar.c:190:
	    LINES = (int)SvIV(ST(1));

CPAN.pm: Going to build G/GI/GIRAFFED/Curses-1.27.tgz

CPAN: CPAN::Reporter loaded ok (v1.1708)
GEN    function:  not applicable
PANELS functions: not enabled
MENUS  functions: not enabled
FORMS  functions: not enabled

Making a guess for -I and -L/-l options...
Guesses:
  includes:    '-I/usr/include/ncurses'
  libs:        '-lncurses'
  Curses type: irrelevant

Then CursesVar.c is regenerated by gen\make.CursesVar.c
It looks like this generation got triggered somehow and gets it wrong.
Because the DLL exporting part of ncurses/ncurses_dll.h does:

/*
 * For reentrant code, we map the various global variables into SCREEN by
 * using functions to access them.
 */
#define NCURSES_PUBLIC_VAR(name) ncwrap_##name
#define NCURSES_WRAPPED_VAR(type,name) extern type
NCURSES_PUBLIC_VAR(name)(void)

> I do not know if I am even on the right forum to ask this, but since I
> encounter it using Cygwin, I decided to start here. Next stop would
> probably be a Perl newsgroup or mailing list.

The CPAN bugtracker for Curses would be best.
I will put my patches also there.

http://search.cpan.org/dist/Curses/
=> http://rt.cpan.org/Public/Dist/Display.html?Name=Curses

> When I compare the current environment with what we where using, then
> we skipped 6 years. We used to use Cygwin 1.3 and 1.5, but then we had
> to stop using that, because we used MontaVista as development
> environment, but we stopped using that a half year ago, and now I want
> to update our environment with the most recent version of cygwin (not
> the least because of screen, but also because of the better completion
> facilities).

-- 
Reini Urban
http://phpwiki.org/           http://murbreak.at/

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