Skip to content

Build failure for -with-code-cache target #23907

Closed
@suresh-srinivas

Description

@suresh-srinivas

The Build fails for -with-code-cache target. It appears that internalBinding is already defined.

out/Release/node --expose-internals tools/generate_code_cache.js out/Release/obj/gen/node_code_cache.cc
internal/bootstrap/cache.js:9
  NativeModule, internalBinding
                ^

SyntaxError: Identifier 'internalBinding' has already been declared
    at NativeModule.compile (internal/bootstrap/loaders.js:275:22)
    at Function.NativeModule.require (internal/bootstrap/loaders.js:168:18)
    at Function.Module._load (internal/modules/cjs/loader.js:523:25)
    at Module.require (internal/modules/cjs/loader.js:643:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/labuser/ssuresh/nodejs-master/tools/generate_code_cache.js:14:5)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
    at Module.load (internal/modules/cjs/loader.js:605:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:544:12)

We were able to make progress by commenting out that line. I havent looked to see where it is define. @joyeecheung @addaleax @hashseed if that is the right thing to do we can raise a PR.

@joyeecheung very nice piece of work to improve startup time. I was wondering why the cache is kept in the executable as opposed to be outside like in Chrome. We can discuss outside this bug. I am interested in the use case of keeping the compiled code for the library in persistent memory.

labuser@y004:~/ssuresh/nodejs-master$ git diff
diff --git a/lib/internal/bootstrap/cache.js b/lib/internal/bootstrap/cache.js
index 41fe1e3..e146f9f 100644
--- a/lib/internal/bootstrap/cache.js
+++ b/lib/internal/bootstrap/cache.js
@@ -6,7 +6,8 @@
 // cannot be tampered with even with --expose-internals
 
 const {
-  NativeModule, internalBinding
+  NativeModule
+ // internalBinding
 } = require('internal/bootstrap/loaders');
 
 function getCodeCache(id) {

  • Version: master
  • Platform: Linux 64-bit.
  • Subsystem: build

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to build files or the CI.toolsIssues and PRs related to the tools directory.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions