milahu / nixpkgs

Nix Packages collection
MIT License
0 stars 0 forks source link

lldb in python: error: unable to locate lldb-server #28

Open milahu opened 4 months ago

milahu commented 4 months ago
support exe dir -> `/nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/bin/`
error: unable to locate lldb-server

obviously, lldb-server is not in the python /bin

$ ls /nix/store/asiphbpiy2gmidfm3xbwcikayhs66289-python3-3.11.7/bin/
2to3  2to3-3.11  idle  idle3  idle3.11  pydoc  pydoc3  pydoc3.11  python  python3  python3.11  python3.11-config  python3-config  python-config

but lldb-server is in $PATH so lldb should use that

$ which lldb-server
/nix/store/vpqd2k73ya6fxkwmy6bznc0xbiah2nq6-lldb-16.0.6/bin/lldb-server

workaround in python

# fix: error: unable to locate lldb-server
# lldb is looking in the wrong $PATH = support exe dir
# https://github.com/NixOS/nixpkgs/pull/119945
# -> set LLDB_DEBUGSERVER_PATH to absolute path of lldb-server
# get absolute path of lldb-server
# TODO shorter?
lldb_server_exe = next(filter(lambda p: os.path.exists(p), map(lambda p: p + "/lldb-server", os.get_exec_path())))
os.environ["LLDB_DEBUGSERVER_PATH"] = lldb_server_exe

see also https://github.com/NixOS/nixpkgs/pull/119945 https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-10/+bug/1894159