Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Sys::MemInfo on AIX

by rgren925 (Beadle)
on Aug 31, 2018 at 22:38 UTC ( #1221479=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks.

I'm installing Sys::MemInfo from cpan and it has installed fine on linux, solaris and hp-ux. It's failing on aix (both 5.3 and 6.1) with the following:

CPAN: Storable loaded ok (v2.49) Reading '/home/nagios/.cpan/Metadata' Database was generated on Mon, 12 Jun 2017 22:29:03 GMT CPAN: LWP::UserAgent loaded ok (v6.27) Fetching with LWP: Reading '/home/nagios/.cpan/sources/authors/01mailrc.txt.gz' CPAN: Compress::Zlib loaded ok (v2.064) ...................................................................... +......DONE Fetching with LWP: Reading '/home/nagios/.cpan/sources/modules/02packages.details.txt.gz' Database was generated on Fri, 31 Aug 2018 21:17:03 GMT ............. New version (v2.16) available. [Currently running version is v2.05] You might want to try install CPAN reload cpan to both upgrade and run the new version without leaving the current session. ...............................................................DONE Fetching with LWP: Reading '/home/nagios/.cpan/sources/modules/' DONE Writing /home/nagios/.cpan/Metadata Running install for module 'Sys::MemInfo' Fetching with LWP: CPAN: Digest::SHA loaded ok (v5.88) Warning (usually harmless): 'YAML' not installed, cannot parse '/home/ +nagios/.cpan/FTPstats.yml' Fetching with LWP: Checksum for /home/nagios/.cpan/sources/authors/id/S/SC/SCRESTO/Sys-Me +mInfo-0.99.tar.gz ok CPAN: File::Temp loaded ok (v0.2304) 'YAML' not installed, will not store persistent state CPAN: CPAN::Meta loaded ok (v2.150010) Configuring S/SC/SCRESTO/Sys-MemInfo-0.99.tar.gz with Makefile.PL Sys::MemInfo for AIX Checking if your kit is complete... Looks good Generating a Unix-style Makefile Writing Makefile for Sys::MemInfo Writing MYMETA.yml and MYMETA.json SCRESTO/Sys-MemInfo-0.99.tar.gz /opt/tools/nagios/perl/bin/perl Makefile.PL -- OK Running make for S/SC/SCRESTO/Sys-MemInfo-0.99.tar.gz CPAN: Module::CoreList loaded ok (v5.020001) cp blib/lib/Sys/ /opt/tools/nagios/perl/bin/perl -e 'use ExtUtils::Mksymlists; + Mksymlists("NAME" => "Sys::MemInfo", "DL_FUNCS" => { }, "FU' Running Mkbootstrap for Sys::MemInfo () chmod 644 /opt/tools/nagios/perl/bin/perl /opt/tools/nagios/perl/lib/5.2 +0.1/ExtUtils/xsubpp -noprototypes -typemap /opt/tools/nagiosc Could not find a typemap for C type 'u_longlong_t'. The following C types are mapped by the current typemap: 'AV *', 'Boolean', 'CV *', 'FILE *', 'FileHandle', 'HV *', 'I16', 'I32 +', 'I8', 'IV', 'InOutStream', 'InputStream', 'NV', 'OutputStr' in MemInfo.xs, line 31 Could not find a typemap for C type 'u_longlong_t'. The following C types are mapped by the current typemap: 'AV *', 'Boolean', 'CV *', 'FILE *', 'FileHandle', 'HV *', 'I16', 'I32 +', 'I8', 'IV', 'InOutStream', 'InputStream', 'NV', 'OutputStr' in MemInfo.xs, line 44 make: 1254-004 The error code from the last command is 1. Stop. SCRESTO/Sys-MemInfo-0.99.tar.gz /bin/make -- NOT OK

I'm guessing that there is some c library that is missing that contains 'u_longlong_t; but I really don't know that stuff very well. Any ideas what I need to do to get this module to install?

Thanks very much, Rick

Replies are listed 'Best First'.
Re: Sys::MemInfo on AIX
by bliako (Monsignor) on Sep 01, 2018 at 12:48 UTC

    In this line from the make log:

    /opt/tools/nagios/perl/bin/perl /opt/tools/nagios/perl/lib/5.2 +0.1/ExtUtils/xsubpp -noprototypes -typemap /opt/tools/nagiosc

    the -typemap param of xsubpp specifies a file which contains data-type mappings between C and XS (see xsubpp). My default typemap file (in /usr/share/perl5/ExtUtils/typemap) starts with these:

    # basic C types int T_IV unsigned T_UV unsigned int T_UV long T_IV unsigned long T_UV ...

    The above command line specifies the typemap file to be /opt/tools/nagiosc. If this is indeed a file and a typemap file then you could try adding a line like this:

    u_longlong_t T_UV

    or, if indeed T_ULONGLONG exists in Perl,:

    u_longlong_t T_ULONGLONG

    The type u_longlong_t most likely refers to C's unsigned long long (a long is 4 bytes, this must be 8 but that's probably system dependent). And must be known to AIX as it is mentioned in libperfstat.h which contains the function signature for perfstat_memory_total() used by arch/aix.xs in Sys::MemInfo.

    The XS files for other systems in Sys::Meminfo, e.g. linux.xs etc. use a double for the return type of the meminfo functions e.g. arch/linux.xs.

    The quick hack would be to replace u_longlong_t with double in file arch/aix.xs

    So, either get a typemap file which contains said datatype mapping (googling got me one for CORBA::omniORB at or replace mapping with a double like the other os's do and see if that works.

    bw, bliako

      It worked!

      The change from u_longlong_t to double actually needed to be made in MemInfo.xs. All the platforms are now working.

      Thank you so much for this! Rick


        just test it so that you make sure you don't loose out on the conversion.

        Maybe the following C program will tell you the type sizes provided you manage to compile it:

        #include <stdio.h> #include <libperfstat.h> int main(void){ printf("double: %d bytes\n", sizeof(double)); printf("u_longlong_t: %d bytes\n", sizeof(u_longlong_t)); printf("unsigned long long: %d bytes\n", sizeof(unsigned long +long)); return(0); }

        Note: others here who do know the internals of Perl may have a better solution, if your application is critical.

        bw, bliako

Re: Sys::MemInfo on AIX
by Laurent_R (Canon) on Sep 01, 2018 at 09:04 UTC
    I'm not sure at all that this is related, but which versions of Perl do you have on your Linux, Solaris, HP-UX, and AIX environments? I'm asking because I used to be stuck with very old versions of Perl (5.8) on some AIX environments we were using (but I can't remember which version of AIX it was, our last old AIX environments have been migrated to Linux about a year ago).
      It's 5.20.1 on all platforms
        OK, thanks, then it's not related to the Perl version. I was just trying to shoot in the dark.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2023-09-23 17:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found