Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Note that doing a Super Search for articles that mention LD_LIBRARY_PATH might have gotten you enough information to get past this problem. I didn't find the answer neatly wrapped up (but I only looked at a couple of the hits), though, so here is one...

You likely can't set LD_LIBRARY_PATH from within the running process no matter how early you do it as the linker/loader has already started loading the process and has cached the value of LD_LIBRARY_PATH. Previously I've work around this by execing the perl executable so that it must reload and will see the new LD_LIBRARY_PATH that I have set. On some operating systems, even that isn't enough as the linker/loader notices that we are execing the same executable and doesn't bother to reinitialize. For such cases, you have to exec a different executable and ask it to exec perl for you.

Something close to the following should work:

BEGIN { my $need= '/usr/local/sybase/lib'; my $ld= $ENV{LD_LIBRARY_PATH}; if( ! $ld ) { $ENV{LD_LIBRARY_PATH}= $need; } elsif( $ld !~ m#(^|:)\Q$need\E(:|$)# ) { $ENV{LD_LIBRARY_PATH} .= ':' . $need; } else { $need= ""; } if( $need ) { exec 'env', $^X, $0, @ARGV; } }

        - tye (but my friends call me "Tye")

In reply to (tye)Re: programatically setting the LD_LIBRARY_PATH by tye
in thread programatically setting the LD_LIBRARY_PATH by LanceDeeply

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-28 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found