Torch couldn't find libstdc++.so.6 nix home manager

I tried to import torch on my python program. However, I encountered this error OSError: libstdc++.so.6: cannot open shared object file: No such file or directory

I installed gcc13 with home-manager. I can find libstdc++.so.6 file at /nix/store/40yjzm7r5ki59kkk9423dnwbm86x7pyd-gcc-13.2.0-lib/lib and at /usr/lib/x86_64-linux-gnu

I have tried to modified modifying LD_LIBRARY_PATH as suggested by some threads, but the stack crash

 ~#@❯ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu

*** stack smashing detected ***: terminated 

More details :

  • I created a python virtualenv for each project with direnv. The content of my .envrc file looks like below
     ~#@❯ cat .envrc
    layout python3
    

If some one can suggest me a solution that works with home manager, I would be tremedously thankful :bowing_man:?

This is resolved !!! I modified the home.sessionVariable in my home.nix file

  home.sessionVariables = {
    # EDITOR = "emacs";
    LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib/"; # fix the problem of dynamic link in python package
  };
1 Like