# Problems with rmagik / glibc: \`GLIBCXX\_3.4.32' not found 

**URL:** https://discourse.nixos.org/t/problems-with-rmagik-glibc-glibcxx-3-4-32-not-found/41738
**Category:** Help
**Created:** [March 18, 2024, 12:44pm UTC](https://discourse.nixos.org/t/problems-with-rmagik-glibc-glibcxx-3-4-32-not-found/41738 "2024-03-18T12:44:24Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![rgoulter](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rgoulter/32/5894_2.png) [@rgoulter](https://discourse.nixos.org/u/rgoulter)
#### Post date: [May 10, 2024, 3:35am UTC](https://discourse.nixos.org/t/problems-with-rmagik-glibc-glibcxx-3-4-32-not-found/41738/7 "2024-05-10T03:35:26Z")

</div>

> [@slinkynexus](#):
>
> how do I use pre-compiled libraries that are used in my work repository?

`LD_LIBRARY_PATH` is the correct environment variable to set.

The system configuration’s `environment.sessionVariables` is the wrong place to set it.

It’s better to set it in a nix shell. If you’re unfamiliar with writing a shell.nix file, [there’s a tutorial on nix.dev](https://nix.dev/tutorials/first-steps/declarative-shell), and [the reference documentation for mkShell in the nixpkgs manual](https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-mkShell).

> [@slinkynexus](#):
>
> LD\_LIBRARY\_PATH is not empty, since I need some libs for local development

I think it’s worth explaining about how `LD_LIBRARY_PATH` being set relates to “`GLIBCXX_` not found”.

On Linux, programs linked against shared libraries are run with the dynamic linker. This is similar to how running `./foo.sh` uses the shebang `#!/usr/bin/env bash` to run/interpret the file.

Some further reading: [this article with a simple demonstration about the dynamic linker from baedung.com](https://www.baeldung.com/linux/dynamic-linker), this unix.stackexchange question [What is /lib64/ld-linux-x86-64.so.2 and why can it be used to execute file?](https://unix.stackexchange.com/questions/400621/what-is-lib64-ld-linux-x86-64-so-2-and-why-can-it-be-used-to-execute-file) (with an answer linking to [an in-depth LWN article about how ELF binaries get run](https://lwn.net/Articles/631631/)).

The [man page for ld-linux](https://linux.die.net/man/8/ld-linux) points out that it uses the `LD_LIBRARY_PATH` to indicate where to look for shared libraries.

On NixOS, a dynamic linker has a path like `/nix/store/35pq4hr29c3sl79lgfwgsvd9nwzyp4am-glibc-2.39-5/lib64/ld-linux-x86-64.so.2`.

So, setting `LD_LIBRARY_PATH` helps when e.g. using Python packages with pre-compiled shared binaries, since it helps Python find those shared libraries.

But, setting it globally also means that all programs are going to pick up the same version of glibc (or other libraries on `LD_LIBRARY_PATH`). Programs packaged with Nix (if packaged correctly) should be able to find the shared libraries they depend on without `LD_LIBRARY_PATH` being set. And apparently can fail with `LD_LIBRARY_PATH` set to include incompatible versions of libraries they’re linked against.

---

_[View the full topic](https://discourse.nixos.org/t/problems-with-rmagik-glibc-glibcxx-3-4-32-not-found/41738)._
