jetpack-io / devbox

Instant, easy, and predictable development environments

Home Page:https://www.jetpack.io/devbox/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stop setting LD_LIBRARY_PATH and LIBRARY_PATH

gcurtis opened this issue · comments

Update Devbox’s print-dev-env environment so that it doesn’t set LD_LIBRARY_PATH and LIBRARY_PATH to .devbox/nix/profile/default/lib.

Details

LD_LIBRARY_PATH overrides where the dynamic linker looks for libraries. We’ve been setting it to .devbox/nix/profile/default/lib so that user programs can find the libraries installed by Devbox. The problem is that this affects all programs, including those not installed by Devbox.

For example, in devbox#1752 the user installed github:nixos/nixpkgs#openssl^out,dev which put a new libcrypto in the lib directory. This newer version of libcrypto is compiled with glibc 2.38, triggering a crash when devbox shell attempted to run nix --version . See this comment for an in-depth explanation of the crash.

LIBRARY_PATH overrides where the linker looks for libraries at compile-time. This causes similar issues when the user builds something, usually through a package manager like pip or bundler.

For example, in devbox#1772 the user ran bundle install which installed the date gem. This gem has a native extension (.devbox/virtenv/ruby_2_7/gems/date-3.3.4/lib/date_core.so) that bundler compiles at install time. date_core got linked against the libraries in lib , but then those couldn’t be found at runtime after LD_LIBRARY_PATH was unset.