Build static libnode_internal to avoid cyclic dependency on mkcodecache #28891
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is a first draft to fix #27431 by implementing exactly this:
node/node.gyp
Lines 1161 to 1166 in 62a809f
The problem here is that the
libnode
shared library is missing the code cache symbols because of the cyclical dependency betweenlibnode
andmkcodecache
in node.gyp.We need to build
mkcodecache
to generatenode_code_cache.cc
. However currentlymkcodecache
itself depends onlibnode
so we cannot include the generated symbols tolibnode
. In the current setupnode_code_cache.cc
is linked when buildingnode.exe
but when building node as a shared library the symbols are missinglibnode
, which causes the issues in #27431.The solution is described comment above: modify the
mkcodecache
build such that it does not depend on the fulllibnode
, but instead on a smallerlibnode_internal
which suffices to generate the cache symbols. And then we can includenode_code_cache.cc
inlibnode.so
.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes