From bf63d695b804b1c995c7ae4427a8a86936ea6d25 Mon Sep 17 00:00:00 2001 From: Michael Hueschen Date: Mon, 22 Jan 2024 03:17:05 -0700 Subject: [PATCH] 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 from sentencepiece import SentencePieceProcessor File "/home/mhueschen/projects-reference/llama.cpp/.venv/lib/python3.11/site-packages/sentencepiece/__init__.py", line 13, in 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... --- .devops/nix/package.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.devops/nix/package.nix b/.devops/nix/package.nix index c25d99f01..91ddb8890 100644 --- a/.devops/nix/package.nix +++ b/.devops/nix/package.nix @@ -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 {