Re: Re: Cygwin PostgreSQL CVS Patch Question

From: Jason Tishler <Jason(dot)Tishler(at)dothill(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-ports(at)postgresql(dot)org
Subject: Re: Re: Cygwin PostgreSQL CVS Patch Question
Date: 2001-01-09 23:16:14
Message-ID: 20010109181614.C1364@dothill.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports

Peter,

On Tue, Jan 09, 2001 at 05:55:39PM -0500, Jason Tishler wrote:
> On Tue, Jan 09, 2001 at 04:34:57PM -0500, Tom Lane wrote:
> > Jason Tishler <Jason(dot)Tishler(at)dothill(dot)com> writes:
> > > Why did you remove the following from src/include/port/win.h?
> > > #if (CYGWIN_VERSION_API_MAJOR >= 0) && (CYGWIN_VERSION_API_MINOR >= 8)
> > > #define sys_nerr _sys_nerr
> > > #endif
> > > This definitely breaks Cygwin.
> >
> > Er, why should it? With the code as it stands, configure should decide
> > that Cygwin doesn't HAVE_SYS_NERR, and so nothing will reference
> > sys_nerr.
>
> Unfortunately, the above is not true:
>
> $ configure
> ...
> checking for sys_nerr... yes
> ...

I have more details as to why the above is occurring.

Consider the following program, j.c, which is derived from the sys_nerr
test program in configure:

extern int sys_nerr;
int main() {
int x = sys_nerr;
; return 0; }

Now compile it with the same (relevant) options used by configure:

$ gcc -O2 -o j j.c

Now compile it without the -O2 option:

$ gcc -o j j.c
/tmp/ccf49pHw.o(.text+0xc):j.c: undefined reference to `sys_nerr'
collect2: ld returned 1 exit status

The problem is gcc -O2 is being too smart, optimizing away the reference
to sys_nerr.

So when configure compiles it's sys_nerr test program it compiles without
errors and returns 0 which fools configure into thinking that Cygwin has
sys_nerr.

Any ideas on what is the best way to solve this problem?

Thanks,
Jason

--
Jason Tishler
Director, Software Engineering Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp. Fax: +1 (732) 264-8798
82 Bethany Road, Suite 7 Email: Jason(dot)Tishler(at)dothill(dot)com
Hazlet, NJ 07730 USA WWW: http://www.dothill.com

In response to

Responses

Browse pgsql-ports by date

  From Date Subject
Next Message Tom Lane 2001-01-09 23:34:33 Re: Cygwin PostgreSQL CVS Patch Question
Previous Message Jason Tishler 2001-01-09 22:55:39 Re: Cygwin PostgreSQL CVS Patch Question