vscode-extensions.vadimcn.vscode-lldb: fix on Darwin
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, #202507
and several runtime-issues:
* codelldb can't find its dynamic libraries (#160874)
* lldb-server from nixpkgs doesn't work due to missing the
"com.apple.security.cs.debugger"
macOS codesigning entitlement, (#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 #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:
* #148946: Error failed to get reply to handshake packet on x86_64-darwin
with vscode-extensions.vadimcn.vscode-lldb
* #160874: codelldb inside of vscode-lldb extension doesn't work
* #202507: vscode-extensions.vadimcn.vscode-lldb fails to build on aarch64-darwin
This commit is contained in:
committed by
Weijia Wang
parent
1dafbd6eb8
commit
d0415e5734
@@ -27,8 +27,14 @@ let
|
||||
|
||||
cargoHash = "sha256-e/Jki/4pCs0qzaBVR4iiUhdBFmWlTZYREQkuFSoWYFo=";
|
||||
|
||||
buildInputs = lib.optionals stdenv.isDarwin [ lldb ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
env = lib.optionalAttrs stdenv.isDarwin {
|
||||
NIX_LDFLAGS = "-llldb -lc++abi";
|
||||
};
|
||||
|
||||
buildAndTestSubdir = "adapter";
|
||||
|
||||
buildFeatures = [ "weak-linkage" ];
|
||||
@@ -89,6 +95,15 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
# debugservers on macOS require the 'com.apple.security.cs.debugger'
|
||||
# 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"
|
||||
else
|
||||
"${lldb.out}/bin/lldb-server";
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
pname = "vscode-extension-${publisher}-${pname}";
|
||||
inherit src version vscodeExtUniqueId vscodeExtPublisher vscodeExtName;
|
||||
@@ -107,6 +122,9 @@ in stdenv.mkDerivation {
|
||||
|
||||
postConfigure = ''
|
||||
cp -r ${nodeDeps}/lib/node_modules .
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export HOME="$TMPDIR/home"
|
||||
mkdir $HOME
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
@@ -129,7 +147,8 @@ in stdenv.mkDerivation {
|
||||
mv -t $ext vsix-extracted/extension/*
|
||||
cp -t $ext/ -r ${adapter}/share/*
|
||||
wrapProgram $ext/adapter/codelldb \
|
||||
--set-default LLDB_DEBUGSERVER_PATH "${lldb.out}/bin/lldb-server"
|
||||
--prefix LD_LIBRARY_PATH : "$ext/lldb/lib" \
|
||||
--set-default LLDB_DEBUGSERVER_PATH "${lldbServer}"
|
||||
# Mark that all components are installed.
|
||||
touch $ext/platform.ok
|
||||
|
||||
|
||||
Reference in New Issue
Block a user