opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.69k stars 894 forks source link

[BUG] Compilation of 2.8.0 fails with node 18 due to lmdb-store #4260

Open inglor opened 1 year ago

inglor commented 1 year ago

Describe the bug

Compilation of 2.8.0 with node 18 fails due to lmdb-store. The error is described here in step 5 and seems like it's fixed in main branch but not on 2.8.0 tag.

main branch: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/packages/osd-optimizer/package.json 2.8.0 branch: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.8.0/packages/osd-optimizer/package.json

Maybe a bad backport merge since it was replaced with lmdb?

To Reproduce Steps to reproduce the behavior:

  1. Verify you are using node 18+
  2. Checkout 2.8.0
  3. yarn osd bootstrap
[..]
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/build/opensearch-dashboards/src/OpenSearch-Dashboards/node_modules/lmdb-store/build'
  CXX(target) Release/obj.target/lmdb/src/node-lmdb.o
  CC(target) Release/obj.target/lmdb/dependencies/lmdb/libraries/liblmdb/midl.o
  CC(target) Release/obj.target/lmdb/dependencies/lmdb/libraries/liblmdb/chacha8.o
  CC(target) Release/obj.target/lmdb/dependencies/lz4/lib/lz4.o
  CXX(target) Release/obj.target/lmdb/src/env.o
  CXX(target) Release/obj.target/lmdb/src/compression.o
  CXX(target) Release/obj.target/lmdb/src/ordered-binary.o
  CXX(target) Release/obj.target/lmdb/src/misc.o
  CXX(target) Release/obj.target/lmdb/src/txn.o
  CXX(target) Release/obj.target/lmdb/src/dbi.o
  CXX(target) Release/obj.target/lmdb/src/cursor.o
  CC(target) Release/obj.target/lmdb/dependencies/lmdb/libraries/liblmdb/mdb.o
../src/ordered-binary.cpp: In function ‘size_t valueToKey(const v8::Local<v8::Value>&, uint8_t*, size_t, bool, bool)’:
../src/ordered-binary.cpp:138:91: error: no matching function for call to ‘v8::Symbol::Description()’
  138 |         Local<String> string = Local<String>::Cast(Local<Symbol>::Cast(jsKey)->Description());
      |                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /build/.cache/node-gyp/18.15.0/include/node/v8-object.h:11,
                 from /build/.cache/node-gyp/18.15.0/include/node/v8-array-buffer.h:13,
                 from /build/.cache/node-gyp/18.15.0/include/node/v8.h:24,
                 from ../src/node-lmdb.h:29,
                 from ../src/ordered-binary.cpp:1:
/build/.cache/node-gyp/18.15.0/include/node/v8-primitive.h:588:16: note: candidate: ‘v8::Local<v8::Value> v8::Symbol::Description(v8::Isolate*) const’
  588 |   Local<Value> Description(Isolate* isolate) const;
      |                ^~~~~~~~~~~
/build/.cache/node-gyp/18.15.0/include/node/v8-primitive.h:588:16: note:   candidate expects 1 argument, 0 provided
make: *** [lmdb.target.mk:146: Release/obj.target/lmdb/src/ordered-binary.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory '/build/opensearch-dashboards/src/OpenSearch-Dashboards/node_modules/lmdb-store/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/build/opensearch-dashboards/src/OpenSearch-Dashboards/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 6.3.6-zen1-1-zen
gyp ERR! command "/usr/bin/node" "/build/opensearch-dashboards/src/OpenSearch-Dashboards/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /build/opensearch-dashboards/src/OpenSearch-Dashboards/node_modules/lmdb-store
gyp ERR! node -v v18.15.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
ERROR [bootstrap] failed:
ERROR Error: Command failed with exit code 1: /usr/lib/node_modules/yarn/bin/yarn.js install --non-interactive
          at makeError (/build/opensearch-dashboards/src/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:25045:11)
          at handlePromise (/build/opensearch-dashboards/src/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:23981:26)
          at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
          at async installInDir (/build/opensearch-dashboards/src/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:23704:3)
          at async Project.installDependencies (/build/opensearch-dashboards/src/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:15168:5)
          at async Object.run (/build/opensearch-dashboards/src/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:9188:11)
          at async runCommand (/build/opensearch-dashboards/src/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:56360:5)
          at async Object.run (/build/opensearch-dashboards/src/OpenSearch-Dashboards/packages/osd-pm/dist/index.js:278:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior Expected to build properly

OpenSearch Version N/A

Dashboards Version tag 2.8.0 from git repo.

Plugins N/A

Screenshots N/A

Additional context

ananzh commented 1 year ago

Yeah seems in this backport PR, we have both lmdb-store here https://github.com/opensearch-project/OpenSearch-Dashboards/blob/8bd48f16ad37a5dfa805234223e4d5bffa926abe/packages/osd-optimizer/package.json#L31

and lmdb https://github.com/opensearch-project/OpenSearch-Dashboards/blob/8bd48f16ad37a5dfa805234223e4d5bffa926abe/packages/osd-optimizer/package.json#L33