-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode-extensions.vadimcn.vscode-lldb: fix on Darwin #211321
Conversation
# entitlement which nixpkgs' lldb-server does not yet provide; see | ||
# <https://github.com/NixOS/nixpkgs/pull/38624> for details | ||
lldbServer = if stdenv.isDarwin then | ||
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would require Xcode to be installed, sadly...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep — absent a way to get the necessary entitlement on a debugserver provided by nixpkgs, Xcode (or another suitably signed binary) is required.
That said, maybe there’s a way to prompt users to install it if needed that I’ve missed — do you see one?
(and in any event, thanks for looking this over + for sharing feedback!)
I tested this out (trying to debug some rust code) and it didn't build for me on aarch64-darwin. I get the following:
|
Hi @DieracDelta -- thanks for trying this out. Regarding reproducing the issue you've reported: what nixpkgs commit did you cherry-pick or otherwise apply the diff from this PR onto? |
@mstone I didn't do any rebasing, just ran: nix run "github:mstone/nixpkgs/darwin-fix-vscode-lldb#legacyPackages.aarch64-darwin.vscode-extensions.llvm-org.lldb-vscode" |
@DieracDelta -- ah, thanks, I think there may have been a small confusion. The patch that I have written for this PR tries to fix llvm-org.lldb-vscode = llvmPackages_8.lldb; which is from many years ago and which I haven't looked into the history of. (Also, for clarity, I think the right way to approach testing this PR is not directly via |
@mstone Thanks for the helpful reply (and this PR)!! I've tested vadimcn.vscode-lldb on aarch64-darwin (with xcode installed) directly off your branch. Works well in neovim with rust-tools.vnim. I'm able to spin up debugger sessions for my rust projects. Note: this is not exactly equivalent to I wonder if that |
Can confirm this patch works tested with nvim as well. |
7cc1d77
to
fa70e74
Compare
OK, rebased. |
pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/default.nix
Outdated
Show resolved
Hide resolved
can we get this merged? |
fa70e74
to
135eff0
Compare
Also getting these types of errors on M1 Apple for vscode-lldb extension.
|
Please merge this, I really need this extension |
No. The two neutral checks literally mean that this PR doesn't work. Probably @reckenrode or @a-n-n-a-l-e-e could help? |
Instead of requiring Xcode’s |
Linking lldb explicitly seems to build. I also had to manually link libc++abi. Someone with a VS Code setup should test. diff --git a/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/default.nix b/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/default.nix
index d476b1fec536..f6ea6d0257be 100644
--- a/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/default.nix
+++ b/pkgs/applications/editors/vscode/extensions/vadimcn.vscode-lldb/default.nix
@@ -27,8 +27,14 @@ let
cargoHash = "sha256-Qq2igtH1XIB+NAEES6hdNZcMbEmaFN69qIJ+gTYupvQ=";
+ buildInputs = lib.optionals stdenv.isDarwin [ lldb ];
+
nativeBuildInputs = [ makeWrapper ];
+ env = lib.optionalAttrs stdenv.isDarwin {
+ NIX_LDFLAGS = "-llldb -lc++abi";
+ };
+
buildAndTestSubdir = "adapter";
buildFeatures = [ "weak-linkage" ];
|
@reckenrode I tried this nixypanda@87c5aa9. I used this in my own dotfiles -> nixypanda/dotfiles#13. This does build, however when I try to use it, it does not work. DetailsI tried to debug a rust program with it. I do this by starting a test in debug mode codelldb application logslogs
nvim-dap logslogs
|
Thanks for testing. The I suspect the issue is |
@reckenrode I am able to start the debugger.
Then I believe waits for more instructions from a client but to test beyond it I will need to look at the debug server protocol which I don't know. In addition to that I also tried to point it to the debug server from Xcode and it works on the latest release Xcode 15.3 vadimcn/codelldb#456 (reply in thread) The following is pure speculation |
135eff0
to
a925084
Compare
Summary: vscode-lldb has been broken on Darwin due to a build-time issue: * on Darwin, the vscode-lldb build scripts expect $HOME to exist and be writable, NixOS#202507 and several runtime-issues: * codelldb can't find its dynamic libraries (NixOS#160874) * lldb-server from nixpkgs doesn't work due to missing the "com.apple.security.cs.debugger" macOS codesigning entitlement, (NixOS#38624), also with the symptom that tccd, the macOS "Transparency, Consent, and Control" daemon, denies requests it receives from vscode/codium with log messages like: "AUTHREQ_CTX: msgID=..., function=<private>, service=kTCCServiceDeveloperTool, preflight=yes, query=1," "Service kTCCServiceDeveloperTool does not allow prompting; returning denied." "AUTHREQ_RESULT: msgID=..., authValue=0, authReason=5, authVersion=1, error=(null),", etc. * lldb-server from nixpkgs may also provide a different CLI interface than codelldb expects on macOS. * vscode-lldb directs lldb to load rust pretty-printing scripts which need to be preserved through the build process in nixpkgs Solution: * The build problem can be fixed by setting HOME="$(pwd)/home", as suggested in NixOS#202507. * The dynamic libraries issue can be fixed by setting LD_LIBRARY_PATH while wrapping codelldb * The permissions issue and CLI interface issue can both be fixed by using Xcode's debugserver, /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver on macOS, since it has the required entitlement and the expected interface. * Finally, the script-loading issue can be fixed by copying the required scripts to the location that vscode-lldb expects to find them in. Fixes: * NixOS#148946: Error failed to get reply to handshake packet on x86_64-darwin with vscode-extensions.vadimcn.vscode-lldb * NixOS#160874: codelldb inside of vscode-lldb extension doesn't work * NixOS#202507: vscode-extensions.vadimcn.vscode-lldb fails to build on aarch64-darwin
a925084
to
d0415e5
Compare
Summary
vscode-lldb has been broken on Darwin due to a build-time issue:
and several runtime-issues:
codelldb can't find its dynamic libraries (codelldb inside of vscode-lldb extension doesn't work #160874)
lldb-server from nixpkgs doesn't work due to missing the
macOS codesigning entitlement, ([wip] codesigning on Darwin #38624), also with the symptom that
tccd, the macOS "Transparency, Consent, and Control" daemon, denies
requests it receives from vscode/codium with log messages like:
lldb-server from nixpkgs may also provide a different CLI interface than codelldb expects on macOS.
vscode-lldb directs lldb to load rust pretty-printing scripts which need to be preserved through the build process in nixpkgs
Solution
The build problem can be fixed by setting HOME="$(pwd)/home", as suggested in vscode-extensions.vadimcn.vscode-lldb: build fails on aarch64-darwin #202507.
The dynamic libraries issue can be fixed by setting LD_LIBRARY_PATH while wrapping codelldb
The permissions issue and CLI interface issue can both be fixed by using Xcode's debugserver,
on macOS, since it has the required entitlement and the expected interface.
Finally, the script-loading issue can be fixed by copying the required scripts to the location that vscode-lldb expects to find them in.
Fixes
(I think:)
vscode-extensions.vadimcn.vscode-lldb: Error
failed to get reply to handshake packet
onx86_64-darwin
#148946: Error failed to get reply to handshake packet on x86_64-darwin with vscode-extensions.vadimcn.vscode-lldbcodelldb inside of vscode-lldb extension doesn't work #160874: codelldb inside of vscode-lldb extension doesn't work
vscode-extensions.vadimcn.vscode-lldb: build fails on aarch64-darwin #202507: vscode-extensions.vadimcn.vscode-lldb fails to build on aarch64-darwin
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes