Bug 290975 - databases/mongosh: Fails to build
Summary: databases/mongosh: Fails to build
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-12 15:17 UTC by Einar Bjarni Halldórsson
Modified: 2025-12-02 21:18 UTC (History)
4 users (show)

See Also:
fabien.amelinck+freebsd: maintainer-feedback+


Attachments
Poudriere build log (143.88 KB, text/plain)
2025-11-12 15:17 UTC, Einar Bjarni Halldórsson
no flags Details
patch that fixes build with node24 (2.39 KB, patch)
2025-11-25 10:49 UTC, Fabien Amelinck
fabien.amelinck+freebsd: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Einar Bjarni Halldórsson 2025-11-12 15:17:14 UTC
Created attachment 265362 [details]
Poudriere build log

mongosh started failing to build at 2025-11-12_03h05m01s

Both 2.5.5_2 and 2.5.5_3 fail in the same way:

Applying patch from /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/scripts/nodejs-patches/001-configure-bz2.patch...
Applying patch from /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/scripts/nodejs-patches/002-workaround-node-bug-52229...
Applying patch from /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/scripts/nodejs-patches/003-no-sys-random-on-older-glibc-node-52223.patch...
Applying patch from /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/scripts/nodejs-patches/004-build-fix-arm64-cross-compilation.patch...
Applying patch from /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/scripts/nodejs-patches/010-src-cares_wrap.h...
Applying patch from /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/scripts/nodejs-patches/011-deps-v8-src-base-small-vector.h...
error: patch failed: deps/v8/src/base/small-vector.h:22
error: deps/v8/src/base/small-vector.h: patch does not apply
  ✖  Failed: applying patch failed with code 1
/wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/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 (/wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/compile/signable-compiler.ts:67:13)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async compileJSFileAsBinaryImpl (/wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/node_modules/boxednode/src/index.ts:387:5)
    at async compileJSFileAsBinary (/wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/node_modules/boxednode/src/index.ts:509:5)
    at async SignableCompiler.compile (/wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/compile/signable-compiler.ts:172:5)
    at async runCompile (/wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/compile/run-compile.ts:21:3)
    at async release (/wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/release.ts:86:5)
    at async /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/index.ts:115:9
npm error Lifecycle script `evergreen-release` failed with error:
npm error code 1
npm error path /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build
npm error workspace @mongosh/build@3.7.0
npm error location /wrkdirs/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build
npm error command failed
npm error command sh -c ts-node -r ../../scripts/import-expansions.js src/index.ts compile
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mongosh
Comment 1 Fabien Amelinck 2025-11-19 09:10:57 UTC
This is due to the newly set node24 as lts. My mongosh port follow node's lts so I have to update some patches.
Comment 2 jonathan 2025-11-24 02:35:57 UTC
I removed that patch file locally and eventually wound up dying with this at the end of the output


→  Running ./configure --disable-shared-readonly-heap --prefix=/usr/local --shared-brotli --shared-cares --shared-libuv --shared-nghttp2 --shared-nghttp3 --shared-ngtcp2 --shared-simdjson --shared-zlib --shared-zstd --shared-openssl --openssl-use-def-ca-store --with-intl=system-icu --without-npm --link-module ./lib-boxednode/mongosh.js ...
Node.js configure: Found Python 3.11.12...
gyp: --disable-shared-readonly-heap not found (cwd: /usr/ports/databases/mongosh/work/boxednode/mongosh/node-v24.11.0) while trying to load --disable-shared-readonly-heap
Error running GYP
  ✖  Failed: Command failed: ./configure --disable-shared-readonly-heap --prefix=/usr/local --shared-brotli --shared-cares --shared-libuv --shared-nghttp2 --shared-nghttp3 --shared-ngtcp2 --shared-simdjson --shared-zlib --shared-zstd --shared-openssl --openssl-use-def-ca-store --with-intl=system-icu --without-npm --link-module ./lib-boxednode/mongosh.js (code 1)
Error: Command failed: ./configure --disable-shared-readonly-heap --prefix=/usr/local --shared-brotli --shared-cares --shared-libuv --shared-nghttp2 --shared-nghttp3 --shared-ngtcp2 --shared-simdjson --shared-zlib --shared-zstd --shared-openssl --openssl-use-def-ca-store --with-intl=system-icu --without-npm --link-module ./lib-boxednode/mongosh.js (code 1)
    at Object.spawnBuildCommand (/usr/ports/databases/mongosh/work/mongosh-2.5.5/node_modules/boxednode/src/helpers.ts:47:11)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async compileNode (/usr/ports/databases/mongosh/work/mongosh-2.5.5/node_modules/boxednode/src/index.ts:212:5)
    at async writeMainFileAndCompile (/usr/ports/databases/mongosh/work/mongosh-2.5.5/node_modules/boxednode/src/index.ts:441:12)
    at async compileJSFileAsBinaryImpl (/usr/ports/databases/mongosh/work/mongosh-2.5.5/node_modules/boxednode/src/index.ts:454:18)
    at async compileJSFileAsBinary (/usr/ports/databases/mongosh/work/mongosh-2.5.5/node_modules/boxednode/src/index.ts:509:5)
    at async SignableCompiler.compile (/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/compile/signable-compiler.ts:172:5)
    at async runCompile (/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/compile/run-compile.ts:21:3)
    at async release (/usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/release.ts:86:5)
    at async /usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build/src/index.ts:115:9
npm error Lifecycle script `evergreen-release` failed with error:
npm error code 1
npm error path /usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build
npm error workspace @mongosh/build@3.7.0
npm error location /usr/ports/databases/mongosh/work/mongosh-2.5.5/packages/build
npm error command failed
npm error command sh -c ts-node -r ../../scripts/import-expansions.js src/index.ts compile
*** Error code 1
Comment 3 Fabien Amelinck 2025-11-25 10:49:31 UTC
Created attachment 265639 [details]
patch that fixes build with node24

I did not update mongosh to the latest version for now. This is just to fix the build of mongosh 2.5.5.
Comment 4 jonathan 2025-11-26 00:39:25 UTC
mongosh built with that patch but I get ">mongosh 
Assertion failed: (EmbedderSnapshotData::CanUseCustomSnapshotPerIsolate()), function RunNodeInstance, file ../src/node_main.cc, line 251." when I try to run it.
Comment 5 Fabien Amelinck 2025-12-02 08:48:36 UTC
I opened an issue upstream:
https://jira.mongodb.org/projects/MONGOSH/issues/MONGOSH-3046

I guess I'll have to set node22 as default build version for now.