Skip to content

Commit bf63d69

Browse files
mhueschSomeoneSerge
authored andcommitted
nix: add cc to devShell LD_LIBRARY_PATH
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...
1 parent 1387ea2 commit bf63d69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.devops/nix/package.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,16 @@ effectiveStdenv.mkDerivation (
221221
;
222222

223223
shell = mkShell {
224+
NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
225+
effectiveStdenv.cc.cc
226+
];
224227
name = "shell-${finalAttrs.finalPackage.name}";
225228
description = "contains numpy and sentencepiece";
226229
buildInputs = [ llama-python ];
227230
inputsFrom = [ finalAttrs.finalPackage ];
231+
shellHook = ''
232+
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH
233+
'';
228234
};
229235

230236
shell-extra = mkShell {

0 commit comments

Comments
 (0)