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

build: separate lldb_include_dir and lldb_lib_dir #185

Merged
merged 2 commits into from
Apr 20, 2018

Conversation

joyeecheung
Copy link
Member

  • Separate detection of lldb headers and lldb shared libraries
    since the headers can be downloaded by us while the libraries
    cannot at the moment. On some systems we are not able to
    find the non-versioned liblldb dynamic library (-llldb) anyway,
    it's working fine until now because the lldb will resolve the
    symbols before loading the plugin, but this will have to be handled
    differently in the case of addons which need the symbols at build time.
    Also use ldd to find the correct name of the library.
  • Use the name lldb_include_dir and lldb_lib_dir and
    point them to subdirectories of the lldb installation to
    match the concepts in llvm-config.
  • Check the $lldb_include_dir/lldb/API for headers since some
    incomplete installations may not have the API headers installed.
  • Stop symlinking ./lldb because we will always run scripts/configure.js
    which can write the path to the headers in the config.gypi anyway.
  • Put the conditional flags in binding.gyp to target_defaults so they
    can be shared by the addon target later.
  • Add more logs in the configuration script about the result of each
    step.
  • Detect llvm-config once and use it if it's available later instead of
    always trying to run it in each configuration step.

In preparation for the addon API.
Refs: #147

- Separate detection of lldb headers and lldb shared libraries
  since the headers can be downloaded by us while the libraries
  cannot at the moment. On some systems we are not able to
  find the non-versioned liblldb dynamic library (`-llldb`) anyway,
  it's working fine until now because the lldb will resolve the
  symbols before loading the plugin, but this will have to be handled
  differently in the case of addons which need the symbols at build time.
  Also use ldd to find the correct name of the library.
- Use the name `lldb_include_dir` and `lldb_lib_dir` and
  point them to subdirectories of the lldb installation to
  match the concepts in llvm-config.
- Check the `$lldb_include_dir/lldb/API` for headers since some
  incomplete installations may not have the API headers installed.
- Stop symlinking ./lldb because we will always run scripts/configure.js
  which can write the path to the headers in the config.gypi anyway.
- Put the conditional flags in binding.gyp to target_defaults so they
  can be shared by the addon target later.
- Add more logs in the configuration script about the result of each
  step.
- Detect llvm-config once and use it if it's available later instead of
  always trying to run it in each configuration step.
@joyeecheung
Copy link
Member Author

The build log now looks like this

Ubuntu 16.04 with lldb-3.9
Build dir is: /root/llnode
Looking for lldb executable...
Found lldb executable /usr/bin/lldb-3.9

Reading lldb version...
Installing llnode for /usr/bin/lldb-3.9, lldb version 3.9

Looking for llvm-config for lldb 3.9...
Using llvm-config in /usr/bin/llvm-config-3.9

Looking for headers for lldb 3.9...
Could not find the headers, will download them later

Looking for shared libraries for lldb 3.9...
From ldd: /usr/bin/lldb-3.9 loads /usr/lib/x86_64-linux-gnu/liblldb-3.9.so.1
Found liblldb-3.9.so in /usr/lib/x86_64-linux-gnu

Cloning lldb release_39 into /root/llnode/lldb-3.9
Cloning into '/root/llnode/lldb-3.9'...
remote: Counting objects: 5565, done.
remote: Compressing objects: 100% (4961/4961), done.
remote: Total 5565 (delta 974), reused 2390 (delta 408), pack-reused 0
Receiving objects: 100% (5565/5565), 17.86 MiB | 16.11 MiB/s, done.
Resolving deltas: 100% (974/974), done.
Checking connectivity... done.
Writing config.gypi:
{
  "variables": {
    "lldb_lib_dir%": "/usr/lib/x86_64-linux-gnu",
    "lldb_lib%": "lldb-3.9",
    "lldb_include_dir%": "/root/llnode/lldb-3.9/include"
  }
}
Writing llnode.sh shortcut to /root/llnode/llnode.sh
MacOS using lldb in Xcode
Build dir is: /Users/joyee/projects/llnode
Using lldb executable lldb

Looking for llvm-config...
No llvm-config found

Reading lldb version...
Deduced lldb version from Xcode version: Xcode 9.2 -> lldb 3.9
Installing llnode for lldb, lldb version 3.9

Looking for headers for lldb 3.9...
Could not find the headers, will download them later

Looking for shared libraries for lldb 3.9...
Could not find the shared libraries
llnode will be linked to the LLDB shared framework from the Xcode installation

Skip cloning lldb headers because /Users/joyee/projects/llnode/lldb-3.9 exists
Writing config.gypi:
{
  "variables": {
    "lldb_include_dir%": "/Users/joyee/projects/llnode/lldb-3.9/include"
  }
}
Writing llnode.sh shortcut to /Users/joyee/projects/llnode/llnode.sh
MacOS using custom lldb 5.0
Build dir is: /Users/joyee/projects/llnode
Using lldb executable lldb

Looking for llvm-config...
Using llvm-config in /usr/local/opt/llvm/bin/llvm-config

Reading lldb version...
Retrieved lldb version 5.0 from `llvm-config --version`
Installing llnode for lldb, lldb version 5.0

Looking for headers for lldb 5.0...
Found lldb headers in /usr/local/Cellar/llvm/5.0.0/include

Looking for shared libraries for lldb 5.0...
Found lldb liblldb.dylib in /usr/local/Cellar/llvm/5.0.0/lib
Writing config.gypi:
{
  "variables": {
    "lldb_lib_dir%": "/usr/local/Cellar/llvm/5.0.0/lib",
    "lldb_include_dir%": "/usr/local/Cellar/llvm/5.0.0/include"
  }
}
Writing llnode.sh shortcut to /Users/joyee/projects/llnode/llnode.sh
FreeBSD with lldb 4.0
Build dir is: /root/llnode
Looking for lldb executable...
Found lldb executable /usr/bin/lldb

Reading lldb version...
Installing llnode for /usr/bin/lldb, lldb version 40

Looking for llvm-config for lldb 40...
Using llvm-config in /usr/local/bin/llvm-config40

Looking for headers for lldb 40...
Found lldb headers in /usr/local/llvm40/include

Looking for shared libraries for lldb 40...
Found lldb liblldb.so in /usr/local/llvm40/lib
Writing config.gypi:
{
  "variables": {
    "lldb_lib_dir%": "/usr/local/llvm40/lib",
    "lldb_include_dir%": "/usr/local/llvm40/include"
  }
}
Writing llnode.sh shortcut to /root/llnode/llnode.sh

bnoordhuis

This comment was marked as off-topic.

@joyeecheung
Copy link
Member Author

Addressed comments from @bnoordhuis

@joyeecheung joyeecheung merged commit 7564d2b into nodejs:master Apr 20, 2018
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

Successfully merging this pull request may close these issues.

2 participants