h2xs -Oxan ... fails when processing GNU/Linux /usr/include/stdio.h

Discussion in 'Perl Misc' started by freeholder, Aug 3, 2006.

  1. freeholder

    freeholder Guest

    I'm attempting to build a module created by an associate that works
    fine on a Solaris 9 system. This is not going to actually be packaged
    up in any way for distribution, it's for internal use on a few systems,
    so we've chosen to simply build the module from scratch for the two
    environments. This may not be the best decision, but that's where we
    are now.

    The problem is that the files and process used successfully on the
    Solaris system fail in the second run of h2xs on the Linux box (both
    Red Hat EL and Debian etch), with the following error:

    --
    $ h2xs -Oxan CLIEXT cliext.h
    Defaulting to backwards compatibility with perl 5.8.4
    If you intend this module to be compatible with earlier perl versions,
    please
    specify a minimum perl version with the -b option.

    Overwriting existing CLIEXT!!!
    Writing CLIEXT/ppport.h
    Scanning typemaps...
    Scanning /usr/local/perl/lib/5.8.4/ExtUtils/typemap
    Scanning cliext.h for functions...
    Expecting parenth after identifier in `struct _IO_FILE_plus
    _IO_2_1_stdin_;
    extern struct _IO_FILE_plus _IO_2_1_stdout_;
    extern struct _IO_FILE_plus _IO_2_1_stderr_;
    # 354 "/usr/include/libio.h" 3 4
    typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t
    __nbytes);

    ....deleted blank lines...

    typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
    size_t __n);

    ....deleted blank lines...

    typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);


    typedef int __io_close_fn (void *__cookie);
    # 406 "/usr/include/libio.h" 3 4
    extern int __underflow (_IO_FILE *) __attribute__ ((__nothrow__))'
    after `struct _IO_FILE_plus _IO_2_1_stdin_' at /usr/local/perl/lib/site
    --

    Nothing useful is created, of course, and we need to use the stdio.h in
    order to get the definition of the FILE pointer type, which is being
    passed from the Perl code to the C routine.

    I would appreciate any assisstance anyone can provide to solve this.

    Thanks,

    Bob (freeholder ;)
    freeholder, Aug 3, 2006
    #1
    1. Advertising

  2. freeholder

    Ben Morrow Guest

    Quoth "freeholder" <>:
    > I'm attempting to build a module created by an associate that works
    > fine on a Solaris 9 system. This is not going to actually be packaged
    > up in any way for distribution, it's for internal use on a few systems,
    > so we've chosen to simply build the module from scratch for the two
    > environments. This may not be the best decision, but that's where we
    > are now.


    Assuming the header declares the same functions on both systems, why not
    just copy the XS file from one to the other, and then port if necessary?

    Ben

    --
    Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
    From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
    (Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
    'Alcestis') [ flame, and falls out of sight. ]
    Ben Morrow, Aug 3, 2006
    #2
    1. Advertising

  3. freeholder

    freeholder Guest

    An excellent idea, which I had tried yesterday evening. There were a
    slew of compiler errors, though. But your idea did lead to our
    managing to get the thing to compile, by going back to the XS file and
    cleaning it up, which is to say we used it as an example and removed
    all the extra stuff h2xs had put in, essentially building the XS file
    by hand.

    This got rid of all the compiler errors and we have an extension that
    builds. Unfortunately, it segfaults, but that is not an issue for this
    list.

    Thanks for the suggestion.

    Bob

    Ben Morrow wrote:
    > Quoth "freeholder" <>:
    > > I'm attempting to build a module created by an associate that works
    > > fine on a Solaris 9 system. This is not going to actually be packaged
    > > up in any way for distribution, it's for internal use on a few systems,
    > > so we've chosen to simply build the module from scratch for the two
    > > environments. This may not be the best decision, but that's where we
    > > are now.

    >
    > Assuming the header declares the same functions on both systems, why not
    > just copy the XS file from one to the other, and then port if necessary?
    >
    > Ben
    >
    > --
    > Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
    > From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
    > (Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
    > 'Alcestis') [ flame, and falls out of sight. ]
    freeholder, Aug 4, 2006
    #3
  4. [A complimentary Cc of this posting was sent to
    freeholder
    <>], who wrote in article <>:
    > $ h2xs -Oxan CLIEXT cliext.h
    > Defaulting to backwards compatibility with perl 5.8.4
    > If you intend this module to be compatible with earlier perl versions,
    > please
    > specify a minimum perl version with the -b option.
    >
    > Overwriting existing CLIEXT!!!
    > Writing CLIEXT/ppport.h
    > Scanning typemaps...
    > Scanning /usr/local/perl/lib/5.8.4/ExtUtils/typemap
    > Scanning cliext.h for functions...
    > Expecting parenth after identifier in `struct _IO_FILE_plus
    > _IO_2_1_stdin_;
    > extern struct _IO_FILE_plus _IO_2_1_stdout_;


    You are not supposed to do this. Run h2xs on a file which defines the
    API. So replace your cliext.h by

    #include <stdio.h>
    #include <cliext_api.h>

    and run h2xs on cliext_api.h.

    Anyway, Perl is not (very) compatible with stdio, so make sure the API
    does not use stdio.h; for this, you may need to break cliext_api.h
    into more parts, keeping the parts accessible from Perl separate from
    parts accessing stdio.

    Hope this helps,
    Ilya
    Ilya Zakharevich, Aug 4, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    18
    Views:
    1,880
    crazzybugger
    Oct 22, 2006
  2. Durduran
    Replies:
    10
    Views:
    522
    Durduran
    Jul 30, 2007
  3. shankha
    Replies:
    0
    Views:
    661
    shankha
    May 5, 2009
  4. anne001
    Replies:
    1
    Views:
    398
  5. Replies:
    2
    Views:
    383
Loading...

Share This Page