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

Unable to load LLDB with LLNODE plugin #430

Open
rvypandey opened this issue May 12, 2023 · 2 comments
Open

Unable to load LLDB with LLNODE plugin #430

rvypandey opened this issue May 12, 2023 · 2 comments

Comments

@rvypandey
Copy link

rvypandey commented May 12, 2023

Describe the bug
When initiating LLDB with LLNODE plugin, it fails

To reproduce
Steps to reproduce the behavior:

  1. Initiated LLDB

  2. Ran command 'plugin load /usr/local/lib/node_modules/llnode/llnode.dylib'

  3. errored - error: this file does not represent a loadable dylib

Expected behavior
LLDB should load LLNODE plugin

Console output
image

Local environment (please complete the following information):

  • Version of llnode - 4.0.0

    (Obtained using npm view llnode version)

  • OS Info: Darwin Ravis-MacBook-Pro.local 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64

    (Obtained using uname -a)

  • lldb Version - lldb-1403.0.17.64

    (Obtained using lldb --version)

  • Version of node.js - v12.3.1

    (Obtained using node --version)

Additional context
I have tried different versions of node, but none worked (16.13.1, 20.x.x etc)
Also, I have installed lldb using XCode installation (Apple Store), version - Xcode 14.3, Build version 14E222b

@gmarcz
Copy link

gmarcz commented Jul 9, 2023

I have the same issue with the plugin on my MacBook Pro M1.
Installed with 'npm install -g llnode' command.

  • llnode: 4.0.0
  • node: v16.20.1
  • lldb: lldb-1403.0.17.67 Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
  • OS: Darwin MacBook-Pro-M1.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103 arm64
  • Xcode: 14.3.1 Build version 14E300c

@matthewkeil
Copy link

matthewkeil commented Dec 7, 2023

I also ran across this issue and was able to resolve it @rvypandey and @gmarcz

The problem is that the install script attempts to download headers for the lldb version that is found on the system but the headers do not appear to match the binary that is included on M1 macs and the dlopen fails (I think that is what is happening).

I was able to resolve this by installing llvm via homebrew and ensuring it was found on the PATH (before the lldb that is bundled with xcode). Using the blurb in the docs did not correctly override the PATH for me and once that issue was resolved llnode was able to find the correct llvm-config and node-gyp built the dylib correctly.

Here are the commands I used to get things installed successfully.

$ brew install llvm
$ echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
$ # note that its before recopying PATH to make sure it resolves
$ zsh ~/.zshrc
$ which llvm-config

Double check withwhich llvm-config that its on PATH. The correct one, from the homebrew install, needs to come up or the llnode install attempts to download the incorrect headers causing the plugin to fail at load time. Even with restarting my shell the PATH was incorrect and I had to open a new one before this worked correctly for some reason 🤷‍♂️

Once llvm-config is found, llnode does not have to download the headers and the ones it uses will match the version of lldb that starts (handled by llvm-config which was not originally on my M1 mac). You can now successfully run the install and the dylib loads fine.

$ npm i -g llnode
$ llnode                            
(lldb) plugin load '/Users/matthewkeil/.nvm/versions/node/v20.5.1/lib/node_modules/llnode/llnode.dylib'
(lldb) settings set prompt '(llnode) '
(llnode) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants