FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Build static libnode_internal to avoid cyclic dependency on mkcodecache by jeroen · Pull Request #28891 · nodejs/node · GitHub

/ node Public

Build static libnode_internal to avoid cyclic dependency on mkcodecache - #28891

Closed
jeroen wants to merge 2 commits into
nodejs:masterfrom
jeroen:statlib_master
Closed

Build static libnode_internal to avoid cyclic dependency on mkcodecache#28891
jeroen wants to merge 2 commits into
nodejs:masterfrom
jeroen:statlib_master

Conversation

jeroen commented Jul 29, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

Here is a first draft to fix #27431 by implementing exactly this:

node/node.gyp

Lines 1161 to 1166 in 62a809f

# TODO(joyeecheung): do not depend on node_lib,
# instead create a smaller static library node_lib_base that does
# just enough for node_native_module.cc and the cache builder to
# compile without compiling the generated code cache C++ file.
# So generate_code_cache -> mkcodecache -> node_lib_base,
# node_lib -> node_lib_base & generate_code_cache

The problem here is that the libnode shared library is missing the code cache symbols because of the cyclical dependency between libnode and mkcodecache in node.gyp.

We need to build mkcodecache to generate node_code_cache.cc. However currently mkcodecache itself depends on libnode so we cannot include the generated symbols to libnode. In the current setup node_code_cache.cc is linked when building node.exe but when building node as a shared library the symbols are missing libnode, which causes the issues in #27431.

The solution is described comment above: modify the mkcodecache build such that it does not depend on the full libnode, but instead on a smaller libnode_internal which suffices to generate the cache symbols. And then we can include node_code_cache.cc in libnode.so.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Jul 29, 2019

Trott commented Jul 31, 2019

Copy link
Copy Markdown
Member

@nodejs/node-gyp @joyeecheung

Comment thread node.gyp
'NODE_OPENSSL_SYSTEM_CERT_PATH=""',
],

'sources': [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

is this list duplicated now?

Trott commented Aug 1, 2019

Copy link
Copy Markdown
Member

Pinging some other folks that I suspect might have opinions: @indutny @addaleax @jasnell @danbev

jeroen commented Aug 1, 2019

Copy link
Copy Markdown
Contributor Author

The bug #27431 has already been fixed via a more simple solution in #28897.

Ideally a rewrite of the build as above would probably be better so that we get the same cached symbols when calling libnode from a 3rd party application as in node itself. However this is just a small performance gain and for my purposes the workaround from #28897 suffices.

jeroen closed this Aug 1, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to build files or the CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link issue with static library of nodejs

4 participants


Back | FazBrowse Home | New Git URL