我正在寻找有关如何使用 perl 运行 SIGAR API 的任何信息或说明。我查看了放置 Makefile.PL 并创建了 makefile 的绑定目录,然后运行了 make 命令,一切正常,但我无法运行任何示例。我还粘贴了运行“exmaples”目录中列出的示例程序时出现的错误。如果我遗漏任何东西,请告诉我。
[oracle@mercury perl]$ perl Makefile.PL
Sigar_generated.xs needs update
generating Sigar_generated.xs
Warning: -L../../sigar-bin/lib changed to -L/u01/test/hyperic-sigar-1.6.4/bindings/perl/../../sigar-bin/lib
Writing Makefile for Sigar
[oracle@mercury perl]$ make
cp Sigar.pm blib/lib/Sigar.pm
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap -typemap typemap Sigar.xs > Sigar.xsc && mv Sigar.xsc Sigar.c
gcc -c -I../../sigar-bin/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/l ocal/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexcep tions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr /lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" -Wall -Werror Sigar.c
Running Mkbootstrap for Sigar ()
chmod 644 Sigar.bs
rm -f blib/arch/auto/Sigar/Sigar.so
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=g eneric Sigar.o -o blib/arch/auto/Sigar/Sigar.so \
-L/u01/test/hyperic-sigar-1.6.4/bindings/perl/../../sigar-bin/lib -lsigar-amd64-linux \
chmod 755 blib/arch/auto/Sigar/Sigar.so
cp Sigar.bs blib/arch/auto/Sigar/Sigar.bs
chmod 644 blib/arch/auto/Sigar/Sigar.bs
[oracle@mercury perl]$ cd examples
[oracle@mercury examples]$ ls
cpu_info.pl df.pl free.pl ifconfig.pl
[oracle@mercury examples]$ perl free.pl
Can't locate Sigar.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site _perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5. 8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /us r/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/p erl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5 /vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/ vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at free.pl line 19.
BEGIN failed--compilation aborted at free.pl line 19.
Ran Make install 和 make test
[root@mercury perl]# make install
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Sigar/Sigar.so
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Sigar/Sigar.bs
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Sigar.pm
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Sigar/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
[root@mercury perl]# make test
No tests defined for Sigar extension.
[root@mercury perl]# cd examples
[root@mercury examples]# ls
cpu_info.pl df.pl free.pl ifconfig.pl
[root@mercury examples]# perl ifconfig.pl
Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Sigar/Sigar.so' for module Sigar: libsigar-amd64-linux.so: cannot open shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/XSLoader.pm line 70.
at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Sigar.pm line 36
Compilation failed in require at ifconfig.pl line 19.
BEGIN failed--compilation aborted at ifconfig.pl line 19.