Skip to content

Commit

Permalink
nix: add cc to devShell LD_LIBRARY_PATH
Browse files Browse the repository at this point in the history
this fixes the error I encountered when trying to run the convert.py
script in a venv:

```
$ nix develop

[...]$ source .venv/bin/activate
(.venv)
[...]$ pip3 install -r requirements.txt
<... clipped ...>
[...]$ python3 ./convert.py
Traceback (most recent call last):
  File "/home/mhueschen/projects-reference/llama.cpp/./convert.py", line 40, in <module>
    from sentencepiece import SentencePieceProcessor
  File "/home/mhueschen/projects-reference/llama.cpp/.venv/lib/python3.11/site-packages/sentencepiece/__init__.py", line 13, in <module>
    from . import _sentencepiece
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
```

however, I am not sure this is the cleanest way to address this linker
issue...
  • Loading branch information
mhuesch authored and SomeoneSerge committed Jan 24, 2024
1 parent 1387ea2 commit bf63d69
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .devops/nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,16 @@ effectiveStdenv.mkDerivation (
;

shell = mkShell {
NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
effectiveStdenv.cc.cc
];
name = "shell-${finalAttrs.finalPackage.name}";
description = "contains numpy and sentencepiece";
buildInputs = [ llama-python ];
inputsFrom = [ finalAttrs.finalPackage ];
shellHook = ''
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH
'';
};

shell-extra = mkShell {
Expand Down

0 comments on commit bf63d69

Please sign in to comment.