Skip to content
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: build fails on aarch64-darwin #202507

Closed
Rasphino opened this issue Nov 23, 2022 · 5 comments
Closed

vscode-extensions.vadimcn.vscode-lldb: build fails on aarch64-darwin #202507

Rasphino opened this issue Nov 23, 2022 · 5 comments
Labels

Comments

@Rasphino
Copy link

Steps To Reproduce

Steps to reproduce the behavior:

  1. run nix build github:nixos/nixpkgs/nixpkgs-unstable#vscode-extensions.vadimcn.vscode-lldb

Build log

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/rfyfxfw9alm3lfbh37b94r7idia3blvy-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/hpb7avwnm52hp9klhxq75c02ihf5gkw6-cmake-build-extension-only.patch
patching file CMakeLists.txt
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/share/doc/CodeLLDB -DCMAKE_INSTALL_INFODIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/include -DCMAKE_INSTALL_SBINDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/lqiqj6s5jx196bpx0mr53d232b57y768-clang-wrapper-11.1.0/bin/strip -DCMAKE_RANLIB=/nix/store/lqiqj6s5jx196bpx0mr53d232b57y768-clang-wrapper-11.1.0/bin/ranlib -DCMAKE_AR=/nix/store/lqiqj6s5jx196bpx0mr53d232b57y768-clang-wrapper-11.1.0/bin/ar -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=/nix/store/ih46mjidpy6baf9klax4jj0drikqd17z-vscode-extension-vadimcn-vscode-lldb-1.7.4 -DVERSION_SUFFIX=
-- The C compiler identification is Clang 11.1.0
-- The CXX compiler identification is Clang 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/lqiqj6s5jx196bpx0mr53d232b57y768-clang-wrapper-11.1.0/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/lqiqj6s5jx196bpx0mr53d232b57y768-clang-wrapper-11.1.0/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Version 1.7.4
-- Could NOT find Python3 (missing: Python3_EXECUTABLE Interpreter)
-- The C compiler identification is Clang 11.1.0
-- The CXX compiler identification is Clang 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/lqiqj6s5jx196bpx0mr53d232b57y768-clang-wrapper-11.1.0/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/lqiqj6s5jx196bpx0mr53d232b57y768-clang-wrapper-11.1.0/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/nix-build-vscode-extension-vadimcn-vscode-lldb-1.7.4.drv-1/source/build/debuggee
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING
    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_DOCDIR
    CMAKE_INSTALL_INCLUDEDIR
    CMAKE_INSTALL_INFODIR
    CMAKE_INSTALL_LIBDIR
    CMAKE_INSTALL_LIBEXECDIR
    CMAKE_INSTALL_LOCALEDIR
    CMAKE_INSTALL_MANDIR
    CMAKE_INSTALL_NAME_DIR
    CMAKE_INSTALL_OLDINCLUDEDIR
    CMAKE_INSTALL_SBINDIR
    CMAKE_POLICY_DEFAULT_CMP0025


-- Build files have been written to: /tmp/nix-build-vscode-extension-vadimcn-vscode-lldb-1.7.4.drv-1/source/build
cmake: enabled parallel building
@nix { "action": "setPhase", "phase": "buildPhase" }
building
build flags: -j8 SHELL=/nix/store/49wn01k9yikhjlxc1ym5b6civ29zz3gv-bash-5.1-p16/bin/bash vsix_bootstrap
[ 12%] Generating extension.js

> vscode-lldb@1.7.4 webpack
> webpack --mode=production --stats=minimal --output-path=/tmp/nix-build-vscode-extension-vadimcn-vscode-lldb-1.7.4.drv-1/source/build --output-filename=extension.js /tmp/nix-build-vscode-extension-vadimcn-vscode-lldb-1.7.4.drv-1/source/extension/main.ts

npm ERR! code EROFS
npm ERR! syscall mkdir
npm ERR! path /homeless-shelter
npm ERR! errno -30
npm ERR! rofs EROFS: read-only file system, mkdir '/homeless-shelter'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.

npm ERR! Log files were not written due to an error writing to the directory: /homeless-shelter/.npm/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
make[3]: *** [CMakeFiles/extension.dir/build.make:91: extension.js] Error 226
make[2]: *** [CMakeFiles/Makefile2:175: CMakeFiles/extension.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:263: CMakeFiles/vsix_bootstrap.dir/rule] Error 2
make: *** [Makefile:231: vsix_bootstrap] Error 2
1 asset
43 modules
webpack 5.73.0 compiled successfully in 2458 ms

Additional context

Add any other context about the problem here.

Notify maintainers

@Artturin @NickHu

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-darwin"`
 - host os: `Darwin 22.1.0, macOS 13.0.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.11.0`
 - channels(rasp): `""`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
@NickHu
Copy link
Contributor

NickHu commented Nov 23, 2022

I think this is a standard Darwin issue. I don't have any of those devices so I haven't personally got any experience with this and no means of testing, but I think this should be easy to fix.

@Artturin
Copy link
Member

adding export HOME=$TMPDIR in preBuild should fix it

@Rasphino
Copy link
Author

adding export HOME=$TMPDIR in preBuild should fix it

Thanks! This works!

@Artturin
Copy link
Member

Make a pr?

@veprbl veprbl added the 6.topic: darwin Running or building packages on Darwin label Dec 5, 2022
qrlex pushed a commit to qrlex/nixpkgs that referenced this issue Oct 9, 2023
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

(cherry picked from commit fa70e74)
wegank pushed a commit to mstone/nixpkgs that referenced this issue Apr 10, 2024
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
@superherointj
Copy link
Contributor

Fixed by #211321

Re-open in case isn't fixed.

@superherointj superherointj changed the title vscode-extensions.vadimcn.vscode-lldb fails to build on aarch64-darwin vscode-extensions.vadimcn.vscode-lldb: build fails on aarch64-darwin Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants