Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > h2xs -Oxan ... fails when processing GNU/Linux /usr/include/stdio.h

Reply
Thread Tools

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

 
 
freeholder
Guest
Posts: n/a
 
      08-03-2006
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

 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      08-03-2006

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. ]
 
Reply With Quote
 
 
 
 
freeholder
Guest
Posts: n/a
 
      08-03-2006
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. ]


 
Reply With Quote
 
Ilya Zakharevich
Guest
Posts: n/a
 
      08-04-2006
[A complimentary Cc of this posting was sent to
freeholder
<>], who wrote in article <. com>:
> $ 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
h2xs Hale Perl 0 12-20-2003 10:19 AM
Recursive inheritance after using h2xs Ken Weaverling Perl Misc 1 10-19-2003 06:50 PM
5.8.0 h2xs seems broken wrt. library arguments Clint Olsen Perl Misc 1 10-16-2003 06:57 AM
Compiling the h2xs way. kspecial@linuxmail.org Perl Misc 2 07-09-2003 03:53 PM
Compiling with H2XS. kspecial@linuxmail.org Perl 0 07-07-2003 10:53 PM



Advertisments