develooper Front page | perl.perl5.porters | Postings from May 2004

Problem with h2xs

Thread Next
David Cannings
May 3, 2004 05:45
Problem with h2xs
Message ID:
I seem to be having difficulty with h2xs.  The version installed is 1.23 
and I'm using Perl v5.8.3.  I've checked perlbug [1] but cannot find 
anything similar.

The first minor problem I encounter is that h2xs does not act as its 
manual page would suggest.  When following the example the directory 
created is "Foo-Bar/", not "Foo/Bar".  A simple diff [2] fixes this.  
Whilst one might argue that the directory name is irrelevant, it is, as 
h2xs goes on to look for Foo/Bar even though it has created Foo-Bar.

The second problem actually stops h2xs from outputting anything useful and 
was documented [3] roughly two years ago.  A new patch [4] to fix this, 
against h2xs 1.23, is below.

h2xs appears to work better now, LocalScan.xs appears to have function 
declarations in and lists these as exports.  Neither file 
lists the enums though which confuses me as I'm not specifying -e.  
Perhaps this is something I've overlooked?

I also get the following error multiple times:

"Use of uninitialized value in concatenation (.) or string 
at /usr/bin/h2xs line 1269."

The area around that line is:

my $meth_doc = '';

if ($opt_x && $opt_a) {
  my($name, $struct);
  $meth_doc .= accessor_docs($name, $struct)
    while ($name, $struct) = each %structs;

The exact command sequence I have followed, adapted from the example in 
the manual page, is:

# h2xs -Afn Exim::LocalScan
# cp exim4-4.31/src/local_scan.[ch] Exim/LocalScan/
# cp exim4-4.31/src/mytypes.h Exim/LocalScan/
# cp exim4-4.31/src/store.h Exim/LocalScan/
# h2xs -AOxan Exim::LocalScan local_scan.h

If I don't specify -A then I get various errors about the autoloading, I 
believe some of these are present in perlbug already though and I do not 
want to use autoloading anyway.

I can run `perl Makefile.PL` but I cannot then go on to run `make`, the 
first error is: LocalScan.c:192: error: syntax error before "arg2".

Can somebody please shed some light on where I am going so horribly wrong 
with h2xs?  Specifically why I cannot run make and why the contents of 
the enum are not copied into the module.  I can make the header file 
available if need be, it's from the MTA Exim.  I am new to Perl and 
really only need to make a module of the header file but I don't want to 
do it manually.

Thank you,


1 -

2- First patch:

--- h2xs        2004-05-03 14:22:11.000000000 +0100
+++ h2xs     2004-05-03 14:22:03.000000000 +0100
@@ -891,5 +891,5 @@

 my @modparts  = split(/::/,$module);
-my $modpname  = join('-', @modparts);
+my $modpname  = join('/', @modparts);
 my $modfname  = pop @modparts;
 my $modpmdir  = join '/', 'lib', @modparts;

3 -

4 - Second patch:

--- h2xs        2004-05-03 14:27:13.000000000 +0100
+++ h2xs     2004-05-03 14:27:34.000000000 +0100
@@ -948,4 +948,6 @@
       $c->set('includeDirs' => ["$Config::Config{archlib}/CORE", $cwd]);

+      $c->get('keywords')->{'__restrict'} = 1;
       push @$fdecls_parsed, @{ $c->get('parsed_fdecls') };
       push(@$fdecls, @{$c->get('fdecls')});

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About