Bug 691480 - cygwin build fails with parse error on esp field in signal.h
Summary: cygwin build fails with parse error on esp field in signal.h
Status: RESOLVED DUPLICATE of bug 691123
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: 8.71
Hardware: PC other
: P4 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-19 13:28 UTC by William Bader
Modified: 2010-07-23 22:14 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments
patches to ensure that esp in estack.h does not conflict with eps in signal.h (1.80 KB, patch)
2010-07-19 13:28 UTC, William Bader
Details | Diff
log of "./configure ; make -k" of gs 8.71 on cygwin (490.74 KB, text/plain)
2010-07-23 12:53 UTC, William Bader
Details

Note You need to log in before you can comment on or make changes to this bug.
Description William Bader 2010-07-19 13:28:40 UTC
Created attachment 6512 [details]
patches to ensure that esp in estack.h does not conflict with eps in signal.h

gs 8.71 fails to build on Windows under cygwin because "base/stat_.h" includes <sys/stat.h> which includes <time.h> which includes <signal.h> which includes <sys/signal.h> which includes <cygwin/signal.h> which defines struct ucontext which has fields with the names of i386 registers including esp.
estack.h defines a macro esp as (e_stack.p).
If estack.h is included before stat_.h, the declaration of the esp field in signal.h gets syntax errors.
For example,

#define esp abc.def
#include <sys/stat.h>
main()
{
}

fails with

In file included from /usr/include/sys/signal.h:107,
                 from /usr/include/signal.h:5,
                 from /usr/include/time.h:140,
                 from /usr/include/sys/stat.h:9,
                 from test.c:2:
/usr/include/cygwin/signal.h:54: error: parse error before '.' token
/usr/include/cygwin/signal.h:58: error: parse error before '}' token

The attached patches fix the problem.

I had a later problem linking because configure found jbig but didn't link it in.  I added a way to pass more libraries to Makefile.in so I could link with -ljbig.  (Makefile.in already had LDFLAGS and XLDFLAGS, but setting them from the command line caused more problems. I think that configure needs to control them.)

The PC is running Windows Server 2003.
uname -a on cygwin returns
CYGWIN_NT-5.2 wtp 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin

William
williambader@hotmail.com
Comment 1 Alex Cherepanov 2010-07-19 17:34:13 UTC
We had this problem before: see bug 689276.
Comment 2 Hin-Tak Leung 2010-07-23 04:36:27 UTC
Which files in 8.71 failed? i.e. an actual list of failed files from "make -k" would be nice. Alex fixed this 3 years ago and I don't think much has changed - one possible candidate is psi/zchar42.c, "string_.h" which was added in 2008; in any case, Alex probably should handle this.
Comment 3 William Bader 2010-07-23 12:53:56 UTC
Created attachment 6534 [details]
log of "./configure ; make -k" of gs 8.71 on cygwin

The parse error from eps happens in psi/zfapi.c.
Comment 4 Chris Liddell (chrisl) 2010-07-23 14:03:31 UTC
I just tried the head revision, and the build completes successfuly, using Cygwin 1.7.5, gcc 4.3.4.
Comment 5 William Bader 2010-07-23 14:32:49 UTC
I have cygwin 1.5.25 and gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125).
Comment 6 Alex Cherepanov 2010-07-23 14:59:30 UTC
This problem has been fixed in the development version, which
is scheduled for release in August 2010.
See bug 691123 for details.

Thank you for using and contributing to Ghostscript.

*** This bug has been marked as a duplicate of bug 691123 ***
Comment 7 Hin-Tak Leung 2010-07-23 22:14:13 UTC
(In reply to comment #3)
> Created an attachment (id=6534) [details]
> log of "./configure ; make -k" of gs 8.71 on cygwin
> 
> The parse error from eps happens in psi/zfapi.c.

I have tried adding CFLAGS -Desp=... against HEAD and built most of the suspects like this file before I asked which files failed. I believe it is fixed in HEAD as the others has verified as well.