Libstdc++.so.6 is not showing up globally

I want to contribute to a open source program and that program requires libstdc++.so.6 as a dependency

  programs.nix-ld.enable = true;

i wrote this in my configuration file and it is still not working

although when i am using this nis shell to run it is working fine

{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  packages = [
    pkgs.python312
    pkgs.gcc
  ];

  shellHook = ''
    # Expose libstdc++.so.6 to Python native extensions
    export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH

    echo " Python: $(python --version)"
    echo " libstdc++ path: ${pkgs.stdenv.cc.cc.lib}/lib"
  '';
} 

the shell is working completely fine

the only problem is my project requires being ran globally as there are multiple kubernetes clusters and demo application that needs to see each other which isn’t possible in a nix shell

can some one please help me with this

This is a common problem in nix. I usually add 2 packages to expose to the LD library path.

Also instead of adding in shellHook , u can add like this as it’s more readable and easily u can add more packages to expose if u want.

Add this inside the mkShell:

env.LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
pkgs.libz
];

This vimjoyer video also will help u with more info too:

1 Like

Thanks a lot this was really helpful