[erlang-questions] os:putenv/2 not helping with erl_ddll:load_driver/2
Paul Mineiro
paul-trapexit@REDACTED
Wed Sep 23 02:27:22 CEST 2009
On Tue, 22 Sep 2009, Steve Vinoski wrote:
> On Tue, Sep 22, 2009 at 2:38 PM, Paul Mineiro <paul-trapexit@REDACTED>wrote:
>
> > I'm encountering a difference between os:putenv/2 and setting the
> > environment variable prior to invoking Erlang.
> >
> > I'm trying to pick up a library that the os puts in a funny place,
> > which my linked-in driver depends upon. Manipulating the environment
> > variable inside Erlang doesn't have the desired effect.
> >
> > Does anybody have a workaround? I don't want to have to restart the
> > emulator to install this software.
> >
>
> Assuming you're on Linux, you can't set the LD_LIBRARY_PATH after the
> process is already running and have it take effect. It's only loaded at
> process startup and can't be changed thereafter within the process for it to
> affect that process. You might consider instead adding a runtime search path
> to your driver at link-time using the -rpath ld option (or -Wl,-rpath,dir
> from gcc).
Wow, you saved me a ton of time! Hopefully also the next person searching
on this as well.
For the record, using libtool, the key option was -R which ultimately sets
rpath, e.g.,
liblpsolveerldrv_la_LDFLAGS = -module -avoid-version -R /usr/lib/lp_solve/
-- p
More information about the erlang-questions
mailing list