Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

h2xs problem handling nested include file(s)

by Bloodnok (Vicar)
on Jul 27, 2012 at 10:15 UTC ( [id://984011]=perlquestion: print w/replies, xml ) Need Help??

Bloodnok has asked for the wisdom of the Perl Monks concerning the following question:

Greeting fellow monastarians ,

Using v5.12.4 perl on Ubuntu 11.10, I seem to have run into problem(s) using h2xs on a header file including it's own nested header file(s) - whereby the attempt always fails to #include the nested file :

h2xs -Oxan IBM::Notes IBM/Notes/acl Defaulting to backwards compatibility with perl 5.12.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 IBM-Notes!!! Writing IBM-Notes/ppport.h Scanning typemaps... Scanning /usr/share/perl/5.12/ExtUtils/typemap Scanning IBM/Notes/acl.h for functions... In file included from <stdin>:1:0: IBM/Notes/acl.h:24:20: fatal error: global.h: No such file or director +y compilation terminated. In file included from <stdin>:1:0: IBM/Notes/acl.h:24:20: fatal error: global.h: No such file or director +y compilation terminated. Scanning IBM/Notes/acl.h for typedefs... Writing IBM-Notes/lib/IBM/Notes.pm Writing IBM-Notes/Notes.xs Writing IBM-Notes/fallback/const-c.inc Writing IBM-Notes/fallback/const-xs.inc Writing IBM-Notes/Makefile.PL Writing IBM-Notes/README Writing IBM-Notes/t/IBM-Notes.t Writing IBM-Notes/Changes Writing IBM-Notes/MANIFEST

I've tried the following, all without any success ....

  • Modifying Makefile.PL to add the path to the included file to the INC definition UPDATE: (in retrospect, this was nugative effort in as much as h2xs re-writes MAKEFILE.pl anyway)
  • Using the '-F' flag to specify the extra '-I' flag to the compiler

In the interests of completeness, I have tried googling for the/any answer/help, but also to no avail, so any & all suggestions/advice gratefully received.

TIA & best rgds to all ,

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re: h2xs problem handling nested include file(s)
by Khen1950fx (Canon) on Jul 27, 2012 at 15:46 UTC
    First, run h2ph. It'll convert C header files to Perl header files. For eample, convert acl.h:
    cd /usr/include h2ph sys/acl.h
    Better yet, translate all the headers in one go:
    h2ph *.h */*.h
    Then run h2xs again.
      TFT, I'll try it, but I read somewhere, during my search, that the use of h2ph is deprecated ... worth a go, nontheless, especially if it works :-)

      A user level that continues to overstate my experience :-))
Re: h2xs problem handling nested include file(s)
by Athanasius (Archbishop) on Jul 28, 2012 at 03:13 UTC

    There may also be a workaround using the C preprocessor. For example, GCC’s cpp has an option -dD which outputs the result of preprocessing (including all nested #include’d headers), but retains the #define directives for all non-predefined macros. See http://gcc.gnu.org/onlinedocs/gcc-3.2/cpp/Invocation.html#Invocation.

    So, if h2ph doesn’t work out, this approach may be worth investigating.

    HTH,

    Athanasius <°(((><contra mundum

Re: h2xs problem handling nested include file(s)
by Anonymous Monk on Jul 28, 2012 at 02:12 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://984011]
Approved by marto
Front-paged by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found