Cannot compile main branch as described in GitHub README

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS: Arch Linux
      node.js / npm versions: 20.20.2 / 10.8.2
      Additional info: Same problem for latest node/npm versions
    • None
    • Developer Tools

      Problem Statement/Rationale

      I'm trying to bring up to date the -git package available on the Arch User Repository. In order to do this, I'm attempting to manually build the project on a clean VM (Official image retrieved from [the Arch Linux Gitlab|https://gitlab.archlinux.org/archlinux/arch-boxes).] However, compilation fails.

       

      There's probably a way to get this to work, but the README doesn't provide any clues and I haven't been able to find any relevant documentation in the manual. If this is actually a software bug, a fix would be greatly appreciated. Otherwise, if it is a documentation issue, I'd like to suggest updating it to prevent further confusion.

       

      Thank you in advance for your precious attention.

      Steps to Reproduce

      Set up a VM with the latest Arch-Box basic image.

      I'm using a headless setup (it comes with a working ssh access out of the box) with qemu, but any other VM setup should do.

       

      Install basic dependencies

      • base-devel: Unsure if necessary, but I have it installed in my VM because I use it specifically to debug packages, so I include it here for the sake of reproducibility.
      • python: Not included in the Requirements section in the README file, but many commands will fail if not installed.
      • nvm: Node v20.x is explicitly required by the README, so I'm using nvm to install Node 20.20.2.
      • git: Necessary to pull the source.

      We can set up these dependencies by running:

      $ sudo pacman -S base-devel python nvm git
      $ source /usr/share/nvm/init-nvm.sh
      $ mkdir nvm #Local install not needed, but I'm doing it like this in my setup to mimic what I'd do in the PKGBUILD
      $ export NVM_DIR=~/nvm
      $ nvm install 20.20.2

       

      Compile mongosh

      Following the README's instructions:

      $ git clone https://github.com/mongodb-js/mongosh.git
      $ cd mongosh
      $ npm run bootstrap
      $ npm run compile
      $ npm run compile-cli

      These commands work. The problem arises when we attempt to execute the next step:

      $ npm run compile-exec

      Fails producing the error log included in the first addendum.

       

      An alternative solution is:

      $ SEGMENT_API_KEY=makepkg npm run compile-exec 

      This seems to correct the last error, but also fails, resulting in the log corresponding to the second addendum.

      This idea doesn't seem to be documented anywhere and I only know of its existence because the former package maintainer used it in the PKGBUILD file.

      It is mentioned [in this community hub post|https://www.mongodb.com/community/forums/t/mongosh-build-failure/14474,] although that's still not official documentation.

      Expected Results

      mongosh compiles without any issues.

      Actual Results

      Compilation fails in the "compile-exec" step.

      Additional Notes

      Addendum #1

      ------------------------

      /home/arch/mongosh/packages/build/src/build-info.ts:18
          throw new Error('Segment key is required');
                ^
      Error: Segment key is required
          at writeBuildInfo (/home/arch/mongosh/packages/build/src/build-info.ts:18:11)
          at generateBundle (/home/arch/mongosh/packages/build/src/compile/generate-bundle.ts:17:23)
          at runCompile (/home/arch/mongosh/packages/build/src/compile/run-compile.ts:14:23)
          at release (/home/arch/mongosh/packages/build/src/release.ts:83:21)
          at /home/arch/mongosh/packages/build/src/index.ts:108:22
          at Object.<anonymous> (/home/arch/mongosh/packages/build/src/index.ts:111:5)
          at Module._compile (node:internal/modules/cjs/loader:1521:14)
          at Module.m._compile (/home/arch/mongosh/node_modules/ts-node/src/index.ts:1618:23)
          at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
          at Object.require.extensions.<computed> [as .ts] (/home/arch/mongosh/node_modules/ts-node/src/index.ts:1621:12)
          at Module.load (node:internal/modules/cjs/loader:1266:32)
          at Function.Module._load (node:internal/modules/cjs/loader:1091:12)
          at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:164:12)
          at phase4 (/home/arch/mongosh/node_modules/ts-node/src/bin.ts:649:14)
          at bootstrap (/home/arch/mongosh/node_modules/ts-node/src/bin.ts:95:10)
          at main (/home/arch/mongosh/node_modules/ts-node/src/bin.ts:55:10)
          at Object.<anonymous> (/home/arch/mongosh/node_modules/ts-node/src/bin.ts:800:3)
          at Module._compile (node:internal/modules/cjs/loader:1521:14)
          at Object.Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
          at Module.load (node:internal/modules/cjs/loader:1266:32)
          at Function.Module._load (node:internal/modules/cjs/loader:1091:12)
          at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:164:12)
          at node:internal/main/run_main_module:28:49
      npm error Lifecycle script `evergreen-release` failed with error:
      npm error code 1
      npm error path /home/arch/mongosh/packages/build
      npm error workspace @mongosh/build@3.10.7
      npm error location /home/arch/mongosh/packages/build
      npm error command failed
      npm error command sh -c ts-node -r ../../scripts/import-expansions.js src/index.ts compile

       

      Addendum #2

      --------------------

      Applying patch from /home/arch/mongosh/scripts/nodejs-patches/001-configure-bz2.patch...
      Applying patch from /home/arch/mongosh/scripts/nodejs-patches/002-workaround-node-bug-52229...
      Applying patch from /home/arch/mongosh/scripts/nodejs-patches/003-no-sys-random-on-older-glibc-node-52223.patch...
      Applying patch from /home/arch/mongosh/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch...
      Applying patch from /home/arch/mongosh/scripts/nodejs-patches/005-ignore-rh-allow-sha1-signatures.patch...
      Applying patch from /home/arch/mongosh/scripts/nodejs-patches/006-no-memfd_create-on-older-glibc.patch...
      error: patch failed: deps/v8/src/wasm/wasm-objects.cc:9
      error: deps/v8/src/wasm/wasm-objects.cc: patch does not apply
        ✖  Failed: applying patch failed with code 1
      /home/arch/mongosh/packages/build/src/compile/signable-compiler.ts:67
            throw new Error(`applying patch failed with code ${code}`);
                  ^
      Error: applying patch failed with code 1
          at Object.preCompileHook (/home/arch/mongosh/packages/build/src/compile/signable-compiler.ts:67:13)
          at processTicksAndRejections (node:internal/process/task_queues:95:5)
          at async compileJSFileAsBinaryImpl (/home/arch/mongosh/packages/build/node_modules/boxednode/src/index.ts:373:5)
          at async compileJSFileAsBinary (/home/arch/mongosh/packages/build/node_modules/boxednode/src/index.ts:511:5)
          at async SignableCompiler.compile (/home/arch/mongosh/packages/build/src/compile/signable-compiler.ts:188:5)
          at async runCompile (/home/arch/mongosh/packages/build/src/compile/run-compile.ts:21:3)
          at async release (/home/arch/mongosh/packages/build/src/release.ts:83:5)
          at async /home/arch/mongosh/packages/build/src/index.ts:108:9
      npm error Lifecycle script `evergreen-release` failed with error:
      npm error code 1
      npm error path /home/arch/mongosh/packages/build
      npm error workspace @mongosh/build@3.10.7
      npm error location /home/arch/mongosh/packages/build
      npm error command failed
      npm error command sh -c ts-node -r ../../scripts/import-expansions.js src/index.ts compile

            Assignee:
            Unassigned
            Reporter:
            Diego Fernández
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: