kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
481 stars 39 forks source link

Error loading shared library (ERR_DLOPEN_FAILED) when cross-compiling #229

Closed dkwo closed 1 year ago

dkwo commented 1 year ago

on linux, when cross-compiling the program ui of https://github.com/influxdata/chronograf from x86_64-musl to aarch64-glibc with CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" npm_config_target_arch=arm64 npm_config_target_platform=linux npm_config_target_libc=glibc make .jsdep assets the step cd ui && yarn run clean && yarn run build fails with

cd ui && yarn --no-progress --no-emoji
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "workspace-aggregator-4aff40ea-0700-4a6b-b51f-8ede52839c87 > chronograf-ui > cypress-image-snapshot@4.0.1" has incorrect peer dependency "cypress@^4.5.0".
warning "workspace-aggregator-4aff40ea-0700-4a6b-b51f-8ede52839c87 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react@>=^16.0.0".
warning "workspace-aggregator-4aff40ea-0700-4a6b-b51f-8ede52839c87 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react-dom@>=^16.0.0".
warning "workspace-aggregator-4aff40ea-0700-4a6b-b51f-8ede52839c87 > chronograf-ui > cypress-image-snapshot > jest-image-snapshot@4.2.0" has incorrect peer dependency "jest@>=20 <=26".
[4/4] Building fresh packages...
$ echo "" > ../node_modules/go.mod
Done in 53.27s.
cd ui && yarn run clean && yarn run build
yarn run v1.22.18
$ rm -rf ./build/* && rm -rf ./.cache ../.parcel-cache
Done in 0.12s.
yarn run v1.22.18
$ APP_VERSION=$npm_package_version GIT_SHA=$(git rev-parse HEAD) parcel build --log-level error
fatal: not a git repository (or any of the parent directories): .git
Error: Error loading shared library ld-linux-aarch64.so.1: No such file or directory (needed by /builddir/chronograf-1.10.1/node_modules/lmdb/build/Release/lmdb.node)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1249:18)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1067:19)
    at require (/builddir/chronograf-1.10.1/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.load [as default] (/builddir/chronograf-1.10.1/node_modules/lmdb/node_modules/node-gyp-build-optional-packages/index.js:20:10)
    at Object.<anonymous> (/builddir/chronograf-1.10.1/node_modules/lmdb/dist/index.cjs:47:47)
    at Module._compile (/builddir/chronograf-1.10.1/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32) {
  code: 'ERR_DLOPEN_FAILED'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [Makefile:62: .jssrc] Error 1

Is there a simple way to fix this? Thanks.

kriszyp commented 1 year ago

Sorry, I am confused as to what is going on here. You are running all of this on x86 (alpine/musl) and trying to build parcel to run on arm64? But then running parcel on x86? Or you want the output of parcel to be somehow compiled for arm64? (if so, what does that mean for JS?)

dkwo commented 1 year ago

Let me clarify: I'm trying to cross-compile a package on Void linux, from host x86_64-musl to target aarch64-glibc. The package (chronograf) is mostly a go package, but its ui uses JS (in the .jsdep and assets parts of the makefile). I'm adding a bunch of npm_config* in order to build for the target, otherwise there are node-gyp errors. At some point the makefile uses yarn, whicn in turn uses parcel for some js dependencies. So yes, it is running parcel on x86, but since I'm cross-compiling, its output should be compiled for arm64. Does this make sense?

dkwo commented 1 year ago

if I remove the npm_config* above, then it fails in a different way:

=> chronograf-1.10.1_1: running pre_build ...
cd ui && yarn --no-progress --no-emoji
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "workspace-aggregator-96fbf68d-3ab1-4600-a61d-383c6738be65 > chronograf-ui > cypress-image-snapshot@4.0.1" has incorrect peer dependency "cypress@^4.5.0".
warning "workspace-aggregator-96fbf68d-3ab1-4600-a61d-383c6738be65 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react@>=^16.0.0".
warning "workspace-aggregator-96fbf68d-3ab1-4600-a61d-383c6738be65 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react-dom@>=^16.0.0".
warning "workspace-aggregator-96fbf68d-3ab1-4600-a61d-383c6738be65 > chronograf-ui > cypress-image-snapshot > jest-image-snapshot@4.2.0" has incorrect peer dependency "jest@>=20 <=26".
[4/4] Building fresh packages...
warning Error running install script for optional dependency: "/builddir/chronograf-1.10.1/node_modules/msgpackr-extract: Command failed.
Exit code: 1
Command: node-gyp-build-optional-packages
Arguments: 
Directory: /builddir/chronograf-1.10.1/node_modules/msgpackr-extract
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@16.19.0 | linux | x64
gyp info find Python using Python version 3.11.3 found at \"/usr/bin/python3\"
gyp http GET https://nodejs.org/download/release/v16.19.0/node-v16.19.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v16.19.0/node-v16.19.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v16.19.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v16.19.0/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/builddir/chronograf-1.10.1/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/builddir/chronograf-1.10.1/node_modules/msgpackr-extract/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/builddir/chronograf-1.10.1/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/.cache/node-gyp/16.19.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/tmp/.cache/node-gyp/16.19.0',
gyp info spawn args   '-Dnode_gyp_dir=/builddir/chronograf-1.10.1/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/tmp/.cache/node-gyp/16.19.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/builddir/chronograf-1.10.1/node_modules/msgpackr-extract',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make[1]: Entering directory '/builddir/chronograf-1.10.1/node_modules/msgpackr-extract/build'
  CXX(target) Release/obj.target/extract/src/extract.o
aarch64-linux-gnu-g++: error: unrecognized command-line option '-m64'
make[1]: *** [extract.target.mk:125: Release/obj.target/extract/src/extract.o] Error 1
make[1]: Leaving directory '/builddir/chronograf-1.10.1/node_modules/msgpackr-extract/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/builddir/chronograf-1.10.1/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 6.2.13_1
gyp ERR! command \"/usr/bin/node\" \"/builddir/chronograf-1.10.1/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /builddir/chronograf-1.10.1/node_modules/msgpackr-extract
gyp ERR! node -v v16.19.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok"
info This module is OPTIONAL, you can safely ignore this error
error /builddir/chronograf-1.10.1/node_modules/lmdb: Command failed.
Exit code: 1
Command: node-gyp-build-optional-packages
Arguments: 
Directory: /builddir/chronograf-1.10.1/node_modules/lmdb
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@16.19.0 | linux | x64
gyp info find Python using Python version 3.11.3 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/builddir/chronograf-1.10.1/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/builddir/chronograf-1.10.1/node_modules/lmdb/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/builddir/chronograf-1.10.1/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/tmp/.cache/node-gyp/16.19.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/tmp/.cache/node-gyp/16.19.0',
gyp info spawn args   '-Dnode_gyp_dir=/builddir/chronograf-1.10.1/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/tmp/.cache/node-gyp/16.19.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/builddir/chronograf-1.10.1/node_modules/lmdb',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make[1]: Entering directory '/builddir/chronograf-1.10.1/node_modules/lmdb/build'
  CXX(target) Release/obj.target/lmdb/src/lmdb-js.o
aarch64-linux-gnu-g++: error: unrecognized command-line option '-m64'
make[1]: *** [lmdb.target.mk:153: Release/obj.target/lmdb/src/lmdb-js.o] Error 1
make[1]: Leaving directory '/builddir/chronograf-1.10.1/node_modules/lmdb/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/builddir/chronograf-1.10.1/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 6.2.13_1
gyp ERR! command "/usr/bin/node" "/builddir/chronograf-1.10.1/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /builddir/chronograf-1.10.1/node_modules/lmdb
gyp ERR! node -v v16.19.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.
make: *** [Makefile:75: .jsdep] Error 1
=> ERROR: chronograf-1.10.1_1: pre_build: 'CFLAGS="$CFLAGS -fPIC" CXXFLAGS="$CXXFLAGS -fPIC" make .jsdep assets' exited with 2
=> ERROR:   in pre_build() at srcpkgs/chronograf/template:29

Notice aarch64-linux-gnu-g++: error: unrecognized command-line option '-m64', but m64 is not in the cross-toolchain.

kriszyp commented 1 year ago

I'm trying to cross-compile a package on Void linux, from host x86_64-musl to target aarch64-glibc.... Does this make sense?

Yes, that makes sense, but it doesn't seem like that is what is happening. All these errors (first ones and last ones) all seem to be errors with compiling parcel to run arm64, but based on your description, that's not what you want anyway. Does the JS ui you are building have any native/binary dependencies that would be architecturally dependent? https://github.com/influxdata/chronograf/blob/master/ui/package.json makes it look like you are mostly building for the web, which is architecturally agnostic (except maybe levelup?).

dkwo commented 1 year ago

Thanks for helping with this. What you say seems right, indeed it is a web ui. On the one hand, I'm confused as to why node-gyp-build-optional-packages is even needed, on the other hand the linked file uses parcel build --log-level error: do you know which parcel command I could try?

kriszyp commented 1 year ago

why node-gyp-build-optional-packages is even needed

Same. lmdb-js provides binaries for all major OSes (including alpine), and node-gyp-build-optional-packages checks to make sure the binaries can be loaded and only triggers a build if binary isn't working for some reason (like some OS incompatibility or library linking issue). I am guessing maybe there is some library linking issue (not entirely surprising with musl) and then somehow the config is convincing the build to try to build for arm64 instead of just the local machine. A good debugging step is to run yarn with --ignore-scripts flag to ensure that no build is executed, and then we could see if it is giving a more direct error when trying to run the provided (musl) binary.

dkwo commented 1 year ago

(Just a remark: this is Void linux, not Alpine, although both can use musl, but I get your point :)

This looks promising. I edited the makefile as you suggested. Now it is unable to find the musl version:

=> chronograf-1.10.1_1: running pre_build ...
cd ui && yarn --no-progress --no-emoji --ignore-scripts
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "workspace-aggregator-ee1153d3-9627-4b4c-9feb-80f8371ad814 > chronograf-ui > cypress-image-snapshot@4.0.1" has incorrect peer dependency "cypress@^4.5.0".
warning "workspace-aggregator-ee1153d3-9627-4b4c-9feb-80f8371ad814 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react@>=^16.0.0".
warning "workspace-aggregator-ee1153d3-9627-4b4c-9feb-80f8371ad814 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react-dom@>=^16.0.0".
warning "workspace-aggregator-ee1153d3-9627-4b4c-9feb-80f8371ad814 > chronograf-ui > cypress-image-snapshot > jest-image-snapshot@4.2.0" has incorrect peer dependency "jest@>=20 <=26".
[4/4] Building fresh packages...
warning Ignored scripts due to flag.
Done in 39.52s.
cd ui && yarn run clean && yarn --ignore-scripts run build
yarn run v1.22.18
$ rm -rf ./build/* && rm -rf ./.cache ../.parcel-cache
Done in 0.11s.
yarn run v1.22.18
$ APP_VERSION=$npm_package_version GIT_SHA=$(git rev-parse HEAD) parcel build --log-level error
fatal: not a git repository (or any of the parent directories): .git
Error: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /builddir/chronograf-1.10.1/node_modules/@lmdb/lmdb-linux-x64/node.napi.glibc.node)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1249:18)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1067:19)
    at require (/builddir/chronograf-1.10.1/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.load [as default] (/builddir/chronograf-1.10.1/node_modules/lmdb/node_modules/node-gyp-build-optional-packages/index.js:20:10)
    at Object.<anonymous> (/builddir/chronograf-1.10.1/node_modules/lmdb/dist/index.cjs:47:47)
    at Module._compile (/builddir/chronograf-1.10.1/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32) {
  code: 'ERR_DLOPEN_FAILED'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [Makefile:62: .jssrc] Error 1
=> ERROR: chronograf-1.10.1_1: pre_build: 'make .jsdep assets' exited with 2
=> ERROR:   in pre_build() at srcpkgs/chronograf/template:39

this is with host=x86_64-musl and target=aarch64-musl, and

export npm_config_target_platform=linux
export npm_config_target_libc=musl
dkwo commented 1 year ago

Interestingly, with the same setup as in my previous comment, even a native x86_64-musl build fails, with the same Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /builddir/chronograf-1.10.1/node_modules/@lmdb/lmdb-linux-x64/node.napi.glibc.node). Is it possible that either the nodejs (16.19.0) or the lmdb version used is too old?

dkwo commented 1 year ago

weirdly, the musl version is there:

$ ls masterdir/builddir/chronograf-1.10.1/node_modules/@lmdb/lmdb-linux-x64/
README.md  index.js  node.abi102.glibc.node  node.abi102.musl.node  node.abi108.glibc.node  node.abi108.musl.node  node.abi83.musl.node  node.abi93.musl.node  node.napi.glibc.node  node.napi.musl.node  package.json
dkwo commented 1 year ago

just to make sure, this is what I changed:

--- a/Makefile  2023-05-09 14:10:03.975291850 -0400
+++ b/Makefile  2023-05-09 14:13:17.400831107 -0400
@@ -59,7 +59,7 @@
    @touch .bindata

 .jssrc: $(UISOURCES)
-   cd ui && yarn run clean && yarn run build
+   cd ui && yarn run clean && yarn --ignore-scripts run build
    @touch .jssrc

 dep: .jsdep .godep
@@ -72,7 +72,7 @@
 ifndef YARN
    $(error Please install yarn 1.19.1+)
 else
-   cd ui && yarn --no-progress --no-emoji
+   cd ui && yarn --no-progress --no-emoji --ignore-scripts
    @touch .jsdep
 endif
kriszyp commented 1 year ago

this is Void linux, not Alpine

Actually... I think this is rather important. From your logs, it is trying to use glibc instead of musl:

needed by /builddir/chronograf-1.10.1/node_modules/@lmdb/lmdb-linux-x64/node.napi.glibc.node)

Because https://github.com/prebuild/node-gyp-build/blob/master/node-gyp-build.js#L15 uses musl if the platform is alpine, determined by https://github.com/prebuild/node-gyp-build/blob/master/node-gyp-build.js#L197. And it sounds like that is probably not entirely accurate. I wonder if you have any suggestions for a better test?

kriszyp commented 1 year ago

I wonder if a minimal change is to check for the existence of /etc/signify/void-release-*.pub (or alpine).

kriszyp commented 1 year ago

Alternately, another thing you could try is running with yarn --ignore-optional to ensure that the binaries are not downloaded and to force a local build and execution of the local binary.

dkwo commented 1 year ago

I see. How about using the npm_config_target_libc variable? I do not have the /etc/signify folder, but note that Void linux supports both musl and glibc.

dkwo commented 1 year ago

with ignore-optional, something else fails :(

=> chronograf-1.10.1_1: running pre_build ...
cd ui && yarn --no-progress --no-emoji --ignore-optional
yarn install v1.22.18
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "workspace-aggregator-ec3a9929-c3a8-44bb-99cc-b02e5a39fcd9 > chronograf-ui > cypress-image-snapshot@4.0.1" has incorrect peer dependency "cypress@^4.5.0".
warning "workspace-aggregator-ec3a9929-c3a8-44bb-99cc-b02e5a39fcd9 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react@>=^16.0.0".
warning "workspace-aggregator-ec3a9929-c3a8-44bb-99cc-b02e5a39fcd9 > chronograf-ui > react-tooltip@3.11.6" has incorrect peer dependency "react-dom@>=^16.0.0".
warning "workspace-aggregator-ec3a9929-c3a8-44bb-99cc-b02e5a39fcd9 > chronograf-ui > cypress-image-snapshot > jest-image-snapshot@4.2.0" has incorrect peer dependency "jest@>=20 <=26".
[4/4] Building fresh packages...
$ echo "" > ../node_modules/go.mod
Done in 60.73s.
cd ui && yarn run clean && yarn run build
yarn run v1.22.18
$ rm -rf ./build/* && rm -rf ./.cache ../.parcel-cache
Done in 0.10s.
yarn run v1.22.18
$ APP_VERSION=$npm_package_version GIT_SHA=$(git rev-parse HEAD) parcel build --log-level error
fatal: not a git repository (or any of the parent directories): .git
🚨 Build failed.

@parcel/transformer-css: Could not resolve module 
"/builddir/chronograf-1.10.1/node_modules/@parcel/css/parcel-css.linux-x64-musl.node"
 from "/builddir/chronograf-1.10.1/node_modules/@parcel/css/node/index.js"

  Error: Could not resolve module 
  "/builddir/chronograf-1.10.1/node_modules/@parcel/css/parcel-css.linux-x64-musl.node"
   from "/builddir/chronograf-1.10.1/node_modules/@parcel/css/node/index.js"
      at $0578d0f6e116167e$export$fb2a0b866a8162dc.resolve 
  (/builddir/chronograf-1.10.1/node_modules/@parcel/package-manager/lib/index.js:5000:21)
      at NodePackageManager.resolveSync 
  (/builddir/chronograf-1.10.1/node_modules/@parcel/package-manager/lib/index.js:3508:42)
      at NodePackageManager.requireSync 
  (/builddir/chronograf-1.10.1/node_modules/@parcel/package-manager/lib/index.js:3351:34)
      at Module.m.require 
  (/builddir/chronograf-1.10.1/node_modules/@parcel/package-manager/lib/index.js:3365:25)
      at require (node:internal/modules/cjs/helpers:103:18)
      at Object.<anonymous> 
  (/builddir/chronograf-1.10.1/node_modules/@parcel/css/node/index.js:21:22)
      at Module._compile (node:internal/modules/cjs/loader:1165:14)
      at Object.Module._extensions..js 
  (node:internal/modules/cjs/loader:1219:10)
      at Module.load (node:internal/modules/cjs/loader:1043:32)
      at NodePackageManager.load 
  (/builddir/chronograf-1.10.1/node_modules/@parcel/package-manager/lib/index.js:3374:15)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [Makefile:62: .jssrc] Error 1
=> ERROR: chronograf-1.10.1_1: pre_build: 'make .jsdep assets' exited with 2
=> ERROR:   in pre_build() at srcpkgs/chronograf/template:32
dkwo commented 1 year ago

or npm_config_libc

kriszyp commented 1 year ago

It supports glibc but doesn't have ld-linux-x86-64.so.2?

npm_config_libc

I am not sure I follow, all users universally have that set? I don't think I do.

I think I am going to try using https://www.npmjs.com/package/detect-libc (I don't know if you want to verify if that correctly indicates musl on your system).

dkwo commented 1 year ago

By 'supports' I meant that there are both flavors available, of course not at the same time :) a given machine will have either musl or glibc, but not both.

I'm not sure how universal the flag is, I thought of it as the file already used env.npm_config_arch and similar.

detect-libc seems a good choice

dkwo commented 1 year ago

detect-libc works here (tested in our build-chroot) with

pre_build() {
        npm install --force detect-libc
        node -p "require('detect-libc').versionSync()"
}

which gives

=> chronograf-1.10.1_1: running pre_build ...
npm WARN using --force Recommended protections disabled.

added 1 package, and audited 2 packages in 357ms

found 0 vulnerabilities
1.1.24
kriszyp commented 1 year ago

Ok, I published this update in 2.8.0 (good timing, just as I was getting this ready).

dkwo commented 1 year ago

Great! Thanks a lot. Do you know how I could force the original go package (chronograf) to use this version?

kriszyp commented 1 year ago

I believe you can use resolutions in your package.json with yarn:

     "resolutions": {
        "lmdb": "^2.8.0"
    }
dkwo commented 1 year ago

it works! thank you