Trouble exporting LD_LIBRARY_PATH



Setting: Perl 5.8.2 on Solaris 9

We need to set these 2 environment variables from Perl:

$ENV{DB2INSTANCE} = 'db2inst3';
$ENV{LD_LIBRARY_PATH} = '/export/home/db2inst3/sqllib/lib';

We even tried enclosing them in a BEGIN block, but we're getting:

install_driver(DB2) failed: Can't load
'/usr/iw-home/iw-perl/site/lib/auto/DBD/DB2/DB2.so' for module DBD:DB2:
ld.so.1: /usr/iw-home/iw-perl/bin/perl: fatal: libdb2.so.1: open failed: No
such file or directory at /usr/iw-home/iw-perl/lib/DynaLoader.pm line 229.
at (eval 6) line 3
Compilation failed in require at (eval 6) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /usr/iw-home/custom/lib/dbAccess.pm line 62

In dbAccess.pm. just before issuing DBI->connect, we've added some logging
information, which shows:

key: |LD_LIBRARY_PATH| value: |/export/home/db2inst3/sqllib/lib|
key: |DB2INSTANCE| value: |db2inst3|

Issuing LD_LIBRARY_PATH=/export/home/db2inst3/sqllib/lib from the command
line results in the same error (at least some of the time), but the log
shows that LD_LIBRARY_PATH is correctly set.

However, issuing export LD_LIBRARY_PATH=/export/home/db2inst3/sqllib/lib
from the command line and running our test script works every time. So how
do we export those environment variables from Perl?

Incidentally, last week the following was causing trouble:

$ENV{'DB2INSTANCE'} = 'db2inst3';
$ENV{'LD_LIBRARY_PATH'} = '/export/home/db2inst3/sqllib/lib';

Note the single-quotes on the left side. Removing them worked (last week).
But not today. Double-quotes or no quotes ain't making a difference.

Looks like things stopped working without any changes to the Perl code. The
PATH changed, I think, but setting it to nothing didn't help. Incidentally,
which binary should be referring to LD_LIBRARY_PATH and loading libdb2.so.1?
Although, why would simply exporting LD_LIBRARY_PATH from the command line
make our test script work?

Any ideas?

Thanks,

S.


.



Relevant Pages

  • Re: Environment limit on NT
    ... the 'system' command seems to be exitting abruptly. ... when I run a perl script containing just the following: ... number of environment variables? ... If you want to stay with 5.6 then upgrade to 5.6.2 or you should probably upgrade to the current version of 5.8.8. ...
    (perl.beginners)
  • Re: Could anyone please answer a simple PERL question.
    ... Hi Marco, ... you posted above normally indicates that "perl" is not part of your "path" ... variable - you can do this for one process with a command like ... Advanced | Environment Variables, but I'm not sure). ...
    (perl.beginners)
  • Re: CPAN.pm configuration
    ... > command that runs the test script uses flags such as ... > How do I configure things such that CPAN.pm uses the Perl (executable ... there are some mentions of just using the use lib when ...
    (comp.lang.perl.misc)
  • RE: Trouble exporting LD_LIBRARY_PATH
    ... Subject: Trouble exporting LD_LIBRARY_PATH ... We need to set these 2 environment variables from Perl: ... from the command line and running our test script works every time. ...
    (perl.dbi.users)
  • Re: Environment veriable
    ... Perl should inherit whatever the environment shell it is called in. ... UNIX) concerning environment variables. ... It should unless the batch file commands prior to it span a new ...
    (perl.beginners)