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

Hi,

When I am trying to run perl script using Sybase::DBlib module(Compiled with Freetds & Sybperl) to connect to Sql Server 2005, i am receiving below errors:

Can't load '/home/valops/sybperl-2.18/usr/local/perl-5.8/lib/site_perl/5.8.4/sun4-solaris-thread-multi/auto/Sybase/DBlib/DBlib.so' for module Sybase::DBlib: ld.so.1: val_equity_finance_report.pl: fatal: relocation error: file /home/valops/sybperl-2.18/usr/local/perl-5.8/lib/site_perl/5.8.4/sun4-solaris-thread-multi/auto/Sybase/DBlib/DBlib.so: symbol PL_memory_wrap: referenced symbol not found at /usr/perl5/5.00503/sun4-solaris/DynaLoader.pm line 169. at /home/bichauha/codevel/shells/cron/val_equity_finance_report.pl line 22 BEGIN failed--compilation aborted at /home/bichauha/codevel/shells/cron/val_equity_finance_report.pl line 22.

What needs to be done, coudnt find a proper resolution.

Replies are listed 'Best First'.
Re: Can't load DBlib.so - sybperl 2.18
by Eliya (Vicar) on Mar 01, 2012 at 13:10 UTC
    .../Sybase/DBlib/DBlib.so: symbol PL_memory_wrap: referenced symbol no +t found at /usr/perl5/5.00503/sun4-solaris/DynaLoader.pm + ^^^^^^^

    This means you're mixing Perl versions.  The module has (likely) been built against perl-5.8.4, but you are trying to load it from within the older Perl binary, version 5.00503, that comes with the Solaris installation (which doesn't provide the symbol PL_memory_wrap).

      I am unabel to find where to change the settings in Makefile to compile teh sybperl against 5.004 version, its defautl setting to new version.

        The instance of Perl you use to invoke the Makefile.PL (or other first-step Perl script) sets which instance of Perl the module will be built for. If you built it for the wrong version, then just rebuild it, this time using the proper instance of Perl to run the Makefile.PL.

        make clean $path_to_version/perl Makefile.PL make ...

        If you do not have a specific need for having two different versions of Perl installed, then it sounds like you would have a much easier time if you were to uninstall the version of Perl that you don't need.

        If you do have a need for two versions of Perl (it is rather common to "leave the 'system' Perl alone" and to install your own version of Perl that you can customize for your needs), then I would next uninstall the version of Perl that you installed and then re-install it, this time making sure that your new version does not share any module directories with the other version of Perl.

        Having two versions of Perl sharing a directory where modules are installed is usually not worth the resulting complexity.

        If the only module directory being shared between the two versions of Perl is your user-specific directory, then we come back to "use the right version of Perl". Make an alias or change your $PATH or something so you stop jumping between Perl versions for different steps of what you are trying to do.

        - tye        

        I would rather go the other way and modify your script val_equity_finance_report.pl (the shebang line, or however you're invoking the script) to use perl-5.8.4  (the system Perl is ancient (!) — though 5.8.4 isn't exactly new either...)

Re: Can't load DBlib.so - sybperl 2.18
by moritz (Cardinal) on Mar 01, 2012 at 12:21 UTC
      but only copied the .pm files

      The error messages make it pretty obvious that this isn't the case. Perl wouldn't say "Can't load $very_specific_path/$mod.so" unless it found a *.so file. Even if it did, the "can't load" would then have a reason of "no such file" not a specific complaint about a symbol reference found in that *.so file not being resolved.

      - tye        

      I did a fresh installation of freetds & sybperl using freetds, unless it wont generate DBlib.so, its something to do with teh library paths, which is done by Dynaloader.pm module

      I googled and found that Dynlaoader.pm loads libraries from default lib paths and then looks @ $LD_LIBRARY_PATH for any new libraries, due to which my DBlib library is probably not referenced.