Skip to content

Build static libnode_internal to avoid cyclic dependency on mkcodecache

Rodrigo Muino Tomonari requested to merge github/fork/jeroen/statlib_master into master

Here is a first draft to fix https://github.com/nodejs/node/issues/27431 by implementing exactly this:

https://github.com/nodejs/node/blob/62a809fa54949fb1416b2462f995bb98037db2d0/node.gyp#L1161-L1166

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 https://github.com/nodejs/node/issues/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

Merge request reports

Loading