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

Hi, I am trying to run check_smb_file.pl to check file share status, this script requires module Filesys::SmbClient. We have installed module manually.
[root@s930l3000 Filesys-SmbClient-3.1]# instmodsh Available commands are: l - List all installed modules m <module> - Select a module q - Quit the program cmd? l Installed modules are: Exception::Class Filesys::SmbClient
But we are receiving below error while running the script file
[root@s930l3000 Filesys-SmbClient-3.1]# /usr/local/nagios/libexec/chec +k_smb_file.pl --help Can't load '/usr/local/lib/perl5/site_perl/5.22.1/x86_64-linux/auto/Fi +lesys/SmbClient/SmbClient.so' for module Filesys::SmbClient: /usr/loc +al/lib/perl5/site_perl/5.22.1/x86_64-linux/auto/Filesys/SmbClient/Smb +Client.so: undefined symbol: PL_curpad at /usr/lib64/perl5/DynaLoader +.pm line 200. at /usr/local/nagios/libexec/check_smb_file.pl line 492. Compilation failed in require at /usr/local/nagios/libexec/check_smb_f +ile.pl line 492. BEGIN failed--compilation aborted at /usr/local/nagios/libexec/check_s +mb_file.pl line 492. [root@s930l3000 Filesys-SmbClient-3.1]#
Kindly advice on above error. Thank you.

Replies are listed 'Best First'.
Re: Can't load perl module Filesys::SmbClient
by 1nickt (Canon) on Jul 05, 2017 at 16:22 UTC

    Hi, your code should go inside <code></code> tags. Didn't you see that it's not rendered sanely? Please edit and fix your post.

    When you get an error complaining about failure to load a library ending in .so, it's usually because your system is missing a required C library that must be compiled and linked to by your desired Perl module.

    Have you followed the documentation for Filesys::SmbClient? As in:

    • Since 3.0 release of this package, you need a least samba-3.0.2. For prior release of Samba, use Filesys::SmbClient version 1.x. For old and 2.x release, this library is available on Samba source, but is not build by default. Do "make bin/libsmbclient.so" in sources directory of Samba to build this libraries. Then copy source/include/libsmbclient.h to /usr/local/samba/include and source/bin/libsmbclient.so to /usr/local/samba/lib before install this module.


    The way forward always starts with a minimal test.
      Thanks for update. Please find below steps which followed for module installation.
      [root@s930l3001 tmp]# cd Filesys-SmbClient-3.1 [root@s930l3001 Filesys-SmbClient-3.1]# ls blib config.h.in configure libauthSamba.c Makefile ME +TA.yml pm_to_blib smb2www.css SmbClient.o t Changes config.log configure.in libauthSamba.h Makefile.PL MY +META.json README SmbClient.bs SmbClient.pm typemap config.h config.status COPYING libauthSamba.o MANIFEST MY +META.yml smb2www-2.cgi SmbClient.c SmbClient.xs [root@s930l3001 Filesys-SmbClient-3.1]# [root@s930l3001 Filesys-SmbClient-3.1]# [root@s930l3001 Filesys-SmbClient-3.1]# [root@s930l3001 Filesys-SmbClient-3.1]# [root@s930l3001 Filesys-SmbClient-3.1]# perl Makefile.PL I search in: /opt/quest/include /usr/local/s/include /s/include /include /usr/s/include /root/include /usr/local/samba/include /usr/local/samba3/include /usr/include /usr/local/include Where can I find libsmbclient.h ? [/usr/include] I search in: /opt/quest/lib /usr/local/s/lib /s/lib /lib /usr/s/lib /root/lib /usr/local/samba/lib /usr/local/lib /usr/lib /usr/local/samba3/lib Where can I find libsmbclient.so ? [] ************************************************************* ** WHAT !!!! ** I Can't find libsmbclient.so : No such file or directory. ************************************************************* If you don't have this file you can download last version of Samba on www.samba.org and do: $ tar zxvf samba-2.2.x.tar.gz $ cd samba-2.2.x/source $ ./configure $ make bin/libsmbclient.so Then you can find libsmbclient.h in source/include directory and libsmbclient.so in source/bin directory. You can then put them in /usr/include and /usr/lib (or /usr/local/include and /usr/local/lib) Do you want make tests ?(you will be prompted for server / worgroup / share / user / password to make read write access. [yes] Server ? [localhost] Share ? [homes] Workgroup/Domain ? [] Smb user ? [root] Smb password ? Compile module with trace to STDERR ? [no] checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for egrep... grep -E checking for working alloca.h... yes checking for alloca... yes checking for smbc_mkdir in -lsmbclient... yes checking for smbc_open in -lsmbclient... yes checking for smbc_fstat in -lsmbclient... yes checking for smbc_init_context in -lsmbclient... yes Good you have SMBCTXX->flags You use SMBCTXX->close_fn (release >= 3.0.20). configure: creating ./config.status config.status: creating config.h config.status: config.h is unchanged Generating a Unix-style Makefile Writing Makefile for Filesys::SmbClient Writing MYMETA.yml and MYMETA.json [root@s930l3001 Filesys-SmbClient-3.1]# ============================================================ [root@s930l3001 Filesys-SmbClient-3.1]# make Skip blib/lib/Filesys/SmbClient.pm (unchanged) Running Mkbootstrap for Filesys::SmbClient () chmod 644 "SmbClient.bs" cc -c -I/usr/include -fwrapv -fno-strict-aliasing -pipe -fstack-prote +ctor -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +-D_FORTIFY_SOURCE=2 -O2 - DVERSION=\"3.1\" -DXS_VERSION=\"3.1\" -fPIC "-I/usr/local/lib/perl5/5. +22.1/x86_64-linux/CORE" libauthSamba.c libauthSamba.c: In function ‘ask_auth_fn’: libauthSamba.c:80: warning: ignoring return value of ‘fgets’, declared + with attribute warn_unused_result libauthSamba.c:88: warning: ignoring return value of ‘fgets’, declared + with attribute warn_unused_result libauthSamba.c:96: warning: ignoring return value of ‘fgets’, declared + with attribute warn_unused_result cc -c -I/usr/include -fwrapv -fno-strict-aliasing -pipe -fstack-prote +ctor -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +-D_FORTIFY_SOURCE=2 -O2 - DVERSION=\"3.1\" -DXS_VERSION=\"3.1\" -fPIC "-I/usr/local/lib/perl5/5. +22.1/x86_64-linux/CORE" SmbClient.c SmbClient.xs: In function ‘XS_Filesys__SmbClient__init’: SmbClient.xs:43: warning: ‘debug’ is deprecated (declared at /usr/incl +ude/libsmbclient.h:2848) SmbClient.xs:45: warning: ‘auth_fn’ is deprecated (declared at /usr/in +clude/libsmbclient.h:2943) SmbClient.xs:46: warning: ‘debug’ is deprecated (declared at /usr/incl +ude/libsmbclient.h:2848) SmbClient.xs: In function ‘XS_Filesys__SmbClient__set_flags’: SmbClient.xs:71: warning: ‘flags’ is deprecated (declared at /usr/incl +ude/libsmbclient.h:3029) SmbClient.xs: In function ‘XS_Filesys__SmbClient__mkdir’: SmbClient.xs:92: warning: ‘mkdir’ is deprecated (declared at /usr/incl +ude/libsmbclient.h:2909) SmbClient.xs: In function ‘XS_Filesys__SmbClient__rmdir’: SmbClient.xs:116: warning: ‘rmdir’ is deprecated (declared at /usr/inc +lude/libsmbclient.h:2910) SmbClient.xs: In function ‘XS_Filesys__SmbClient__opendir’: SmbClient.xs:138: warning: ‘opendir’ is deprecated (declared at /usr/i +nclude/libsmbclient.h:2905) SmbClient.xs: In function ‘XS_Filesys__SmbClient__closedir’: SmbClient.xs:165: warning: ‘closedir’ is deprecated (declared at /usr/ +include/libsmbclient.h:2906) SmbClient.xs: In function ‘XS_Filesys__SmbClient__readdir’: SmbClient.xs:197: warning: ‘readdir’ is deprecated (declared at /usr/i +nclude/libsmbclient.h:2907) SmbClient.xs: In function ‘XS_Filesys__SmbClient__stat’: SmbClient.xs:225: warning: ‘stat’ is deprecated (declared at /usr/incl +ude/libsmbclient.h:2899) SmbClient.xs: In function ‘XS_Filesys__SmbClient__fstat’: SmbClient.xs:261: warning: ‘fstat’ is deprecated (declared at /usr/inc +lude/libsmbclient.h:2900) SmbClient.xs: In function ‘XS_Filesys__SmbClient__rename’: SmbClient.xs:293: warning: ‘rename’ is deprecated (declared at /usr/in +clude/libsmbclient.h:2897) SmbClient.xs: In function ‘XS_Filesys__SmbClient__open’: SmbClient.xs:338: warning: ‘open’ is deprecated (declared at /usr/incl +ude/libsmbclient.h:2892) SmbClient.xs:349: warning: ‘lseek’ is deprecated (declared at /usr/inc +lude/libsmbclient.h:2898) SmbClient.xs: In function ‘XS_Filesys__SmbClient__read’: SmbClient.xs:368: warning: ‘read’ is deprecated (declared at /usr/incl +ude/libsmbclient.h:2894) SmbClient.xs: In function ‘XS_Filesys__SmbClient__write’: SmbClient.xs:392: warning: ‘write’ is deprecated (declared at /usr/inc +lude/libsmbclient.h:2895) SmbClient.xs: In function ‘XS_Filesys__SmbClient__lseek’: SmbClient.xs:418: warning: ‘lseek’ is deprecated (declared at /usr/inc +lude/libsmbclient.h:2898) SmbClient.xs: In function ‘XS_Filesys__SmbClient__close’: SmbClient.xs:446: warning: ‘close_fn’ is deprecated (declared at /usr/ +include/libsmbclient.h:2904) SmbClient.xs: In function ‘XS_Filesys__SmbClient__unlink’: SmbClient.xs:464: warning: ‘unlink’ is deprecated (declared at /usr/in +clude/libsmbclient.h:2896) rm -f blib/arch/auto/Filesys/SmbClient/SmbClient.so LD_RUN_PATH="/usr/lib/../lib64" cc -shared -O2 -L/usr/local/lib -fsta +ck-protector libauthSamba.o SmbClient.o -o blib/arch/auto/Filesys/Sm +bClient/SmbClient.so \ -lsmbclient \ chmod 755 blib/arch/auto/Filesys/SmbClient/SmbClient.so "/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- SmbC +lient.bs blib/arch/auto/Filesys/SmbClient/SmbClient.bs 644 Manifying 1 pod document ====================================================================== +=== [root@s930l3001 Filesys-SmbClient-3.1]# [root@s930l3001 Filesys-SmbClient-3.1]# make install Running Mkbootstrap for Filesys::SmbClient () chmod 644 "SmbClient.bs" Manifying 1 pod document Files found in blib/arch: installing files in blib/lib into architectu +re dependent library tree Installing /usr/local/lib/perl5/site_perl/5.22.1/x86_64-linux/auto/Fil +esys/SmbClient/SmbClient.so Appending installation info to /usr/local/lib/perl5/5.22.1/x86_64-linu +x/perllocal.pod [root@s930l3001 Filesys-SmbClient-3.1]# [root@s930l3001 Filesys-SmbClient-3.1]#
Re: Can't load perl module Filesys::SmbClient
by Anonymous Monk on Jul 05, 2017 at 22:27 UTC

    See Re: libwww-perl fails

    The problem is Filesys::SmbClient was installed using a different perl version that the perl version trying to load it

    So, re-install Filesys::SmbClient using the current perl version, that way when current perl version tried to load Filesys::SmbClient it will work

    Or dont try to run the program using this different perl version than the version that installed the module, use the same perl version that was used to install Filesys::SmbClient

      As stated in the thread this works one one server, but not on another. bvani said that the perl version was different between servers, and that they had tried to install the module into various different places on the server where the error is being produced. As the error message and instance log show, perl isn't looking in the path it was installed. There's no evidence that there are multiple perls on the same server causing this problem.

        Then libperl is corrupted somehow

        If its a system perl check the sums or whatever

        Or just install a local perl

      Hi, Can you let me know how to check perl version used to install module and perl version used to load module. Below is some information from server that can help.
      [root@s930l3099 Filesys-SmbClient-3.1]# perl -MFilesys::SmbClient -e'p +rint $_ . " => " . $INC{$_} . "\n" for keys %INC' Tie/Hash.pm => /usr/local/lib/perl5/5.22.1/Tie/Hash.pm Tie/StdHandle.pm => /usr/local/lib/perl5/5.22.1/Tie/StdHandle.pm strict.pm => /usr/local/lib/perl5/5.22.1/strict.pm warnings/register.pm => /usr/local/lib/perl5/5.22.1/warnings/register. +pm Config.pm => /usr/local/lib/perl5/5.22.1/x86_64-linux/Config.pm AutoLoader.pm => /usr/local/lib/perl5/5.22.1/AutoLoader.pm vars.pm => /usr/local/lib/perl5/5.22.1/vars.pm Carp.pm => /usr/local/lib/perl5/5.22.1/Carp.pm Fcntl.pm => /usr/local/lib/perl5/5.22.1/x86_64-linux/Fcntl.pm Filesys/SmbClient.pm => /usr/local/lib/perl5/site_perl/5.22.1/x86_64-l +inux/Filesys/SmbClient.pm XSLoader.pm => /usr/local/lib/perl5/5.22.1/XSLoader.pm POSIX.pm => /usr/local/lib/perl5/5.22.1/x86_64-linux/POSIX.pm warnings.pm => /usr/local/lib/perl5/5.22.1/warnings.pm DynaLoader.pm => /usr/local/lib/perl5/5.22.1/x86_64-linux/DynaLoader.p +m Exporter.pm => /usr/local/lib/perl5/5.22.1/Exporter.pm Tie/Handle.pm => /usr/local/lib/perl5/5.22.1/Tie/Handle.pm constant.pm => /usr/local/lib/perl5/5.22.1/constant.pm You have new mail in /var/spool/mail/root [root@s930l3099 Filesys-SmbClient-3.1]#
      Thank you!
        Check the path?
A reply falls below the community's threshold of quality. You may see it by logging in.