# Using ENV to update LD\_LIBRARY\_PATH has no effect

**URL:** <https://discourse.julialang.org/t/using-env-to-update-ld-library-path-has-no-effect/5031>\
**Category:** New to Julia\
**Created:** [July 23, 2017, 9:14pm UTC](https://discourse.julialang.org/t/using-env-to-update-ld-library-path-has-no-effect/5031 "2017-07-23T21:14:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaredCrean2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaredcrean2/32/3574_2.png) [@JaredCrean2](https://discourse.julialang.org/u/JaredCrean2)\
**Post date:** [July 23, 2017, 9:14pm UTC](https://discourse.julialang.org/t/using-env-to-update-ld-library-path-has-no-effect/5031/1 "2017-07-23T21:14:41Z")

</div>

I’m trying to use `ENV` to update `LD_LIBRARY_PATH` so I can call code in a shared library, but the shared library can’t be found. If I update `LD_LIBRARY_PATH` before launching Julia it works correctly. Has anyone encountered this before?

I did look at using `DL_LOAD_PATH`, but I need to make shared libraries discoverable by other shared libraries, not just by Julia itself.

I made a minimal example [here](https://github.com/JaredCrean2/ld_test). Run `make.sh` and then `julia ./test.jl`.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [July 23, 2017, 10:09pm UTC](https://discourse.julialang.org/t/using-env-to-update-ld-library-path-has-no-effect/5031/2 "2017-07-23T22:09:05Z")

</div>

The env can be/is cached by libc at init time so changing it will have no effect for the current process.

This is not the correct way to help libraries finding their dependencies, they should have their rpath set instead. Or if they can’t be fixed, you can manually dlopen their dependencies.

---

<div class="post-metadata">

**Author:** ![JaredCrean2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaredcrean2/32/3574_2.png) [@JaredCrean2](https://discourse.julialang.org/u/JaredCrean2)\
**Post date:** [July 24, 2017, 2:36pm UTC](https://discourse.julialang.org/t/using-env-to-update-ld-library-path-has-no-effect/5031/3 "2017-07-24T14:36:30Z")

</div>

Interesting, thanks
