vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.59k stars 246 forks source link

improve NixOS troubleshooting in wiki #487

Open sefidel opened 3 years ago

sefidel commented 3 years ago

While the first 3 patchelf command makes the binary "start", it immediately quits with error regarding libz. I was able to get it to work after running those 3 commands, so I think it'd be better to add those to the wiki:

$ patchelf --add-needed $LIBZ $VSCODE/extensions/vadimcn.vscode-lldb-1.6.5/adapter/codelldb
$ patchelf --add-needed $LIBZ $VSCODE/extensions/vadimcn.vscode-lldb-1.6.5/lldb/bin/lldb
$ patchelf --add-needed $LIBZ $VSCODE/extensions/vadimcn.vscode-lldb-1.6.5/lldb/bin/lldb-server

where LIBZ is a path to libz.so.1 e.g /nix/store/*zlib*/lib/libz.so.1

Avi-D-coder commented 2 years ago

This does not seem to work. Same result before and after patching.

❯ strace ./vadimcn.vscode-lldb-1.6.10/adapter/codelldb
execve("./vadimcn.vscode-lldb-1.6.10/adapter/codelldb", ["./vadimcn.vscode-lldb-1.6.10/ada"...], 0x7ffc66f38c20 /* 88 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++

Also no luck installing and running this extension in nix-shell -p zlib.

Avi-D-coder commented 2 years ago

vscode-fhs is a workaround.

concatime commented 11 months ago
CODELLDB=~/.vscode-oss/extensions/vadimcn.vscode-lldb-1.10.0-universal/adapter/codelldb
patchelf --set-interpreter /nix/store/9y8pmvk8gdwwznmkzxa6pwyah52xy3nk-glibc-2.38-27/lib/ld-linux-x86-64.so.2 "$CODELLDB"
patchelf --add-rpath /nix/store/lprrvg44cyn9ajpq77lh7rlnp4kzdqzs-zlib-1.3/lib "$CODELLDB"
patchelf --add-needed libz.so.1 "$CODELLDB"
"$CODELLDB" -V