Building on Cygwin

Discussion in 'Perl Misc' started by Nigel, Apr 17, 2014.

  1. Nigel

    Nigel Guest

    To date I have been able to build Perl on Cygwin with no problems but on a new machine I have had problems. Any version that I try to build gives error when trying to compile cygwin.c:

    nostdio.h:25:14: error: two or more data types in declaration specifiers
    #define FILE struct _FILE

    Any ideas?


    Nigel, Apr 17, 2014
    1. Advertisements

  2. Nigel

    Peter Gordon Guest

    I assume you know that Perl 5.14.2 is included in Cygwin. (It
    is not part of the default setup, but if you search for it
    during setup, you will get a number of hits)
    Peter Gordon, Apr 17, 2014
    1. Advertisements

  3. NB: This is not really related to Perl.

    You could try to run the .c file through the preprocessor, delete all
    preprocessing directives from that and try to compile the
    result[*]. This should result in the same error message but you'll find
    the actual code the compiler couldn't processed on the corresponding
    line of the input file.

    [*] Simplistic example based on gcc: When trying to compile following .c file,

    #define printf (1 + 2)

    #include <stdio.h>

    int main(void)
    return 0;

    an error message

    In file included from a.c:3:
    /usr/include/stdio.h:339: error: expected identifier or '(' before numeric constant

    is printed. Line 339 of stdio.h is the printf prototype. Applying the
    procedure suggested above,

    [[email protected]]/tmp#gcc -E a.c >x.c
    [[email protected]]/tmp#ed x.c <<TT
    [[email protected]]/tmp#gcc x.c
    x.c:418: error: expected identifier or '(' before numeric constant
    [[email protected]]/tmp#cat -n x.c | awk '{ if ($1 == 418) print $0; }'
    418 extern int (1 + 2) (__const char *__restrict __format, ...);

    That's not of much use for this contrived example, but usually helpful
    in case of less trivial macro arrangements.
    Rainer Weikusat, Apr 18, 2014
  4. [...]
    More on topic: While this also qualifies for an 'awkward use of
    awk'-award, a nicer way to express this in perl would be

    perl -ne '$. == 418 and print' <x.c


    perl -ne '$. == 418 and print, exit' <x.c

    in case the file is large enough that uselessly processing the remainder
    ought to be avoided.
    Rainer Weikusat, Apr 18, 2014
  5. [followed by an in-depth explanated example how to do that]
    Unless you have something more useful to say, why don't you offload your
    eminent wisdom to a parking meter?
    Rainer Weikusat, Apr 27, 2014
  6. Στις 17/4/2014 18:21, ο/η Nigel έγÏαψε:

    Op is missing from the thread but anyway.
    There is not ANY reason to compile Perl using cygwin because now there
    is the strawberry Perl, which includes the gcc and can install any
    module from cpan from source.
    George Mpouras, Apr 27, 2014
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.