adnanrahic / node-gcstats

The Unlicense
9 stars 14 forks source link

Cannot build the project which uses `spm-agent-nodejs` for `linux armv7/arm64` architectures #16

Open sinnrrr opened 1 year ago

sinnrrr commented 1 year ago

Quick description

Hi! I use cameras on the armv7 and arm64 architectures. While everything works well on my PC (MacOS on M1 - arm64) when I run it on the cameras or try to install packages on them, I get a pile of errors.

Runtime logs

Running the app via nodejs

Error: Cannot find module '/snapshot/app/node_modules/@sematext/gc-stats/build/gcstats/v1.5.8/Release/node-v93-linux-arm-unknown/gcstats.node'
Require stack:
    at Module._compile (pkg/prelude/bootstrap.js:1930:22)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (pkg/prelude/bootstrap.js:1855:31)
    at Object.<anonymous> (/snapshot/app/node_modules/@sematext/gc-stats/index.js:7:13)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at require (node:internal/modules/cjs/helpers:102:18)
  code: 'MODULE_NOT_FOUND',
    '/snapshot/app/build/app.js'
    '/snapshot/app/node_modules/@sematext/gc-stats/index.js',
    '/snapshot/app/node_modules/spm-agent-nodejs/lib/gcAgent.js',
    '/snapshot/app/node_modules/spm-agent-nodejs/lib/index.js',

Build logs (npm install):

Please note that python and python3 ARE available on build time and can be seen in PATH.

#14 28.21 warning Error running install script for optional dependency: "/opt/app/node_modules/cpu-fea
tures: Command failed.
#14 28.21 Exit code: 1
#14 28.21 Command: node buildcheck.js > buildcheck.gypi && node-gyp rebuild
#14 28.21 Arguments: 
#14 28.21 Directory: /opt/app/node_modules/cpu-features
#14 28.21 Output:
#14 28.21 /opt/app/node_modules/buildcheck/lib/index.js:115
#14 28.21   throw new Error('Unable to detect compiler type');
#14 28.21   ^
#14 28.21 
#14 28.21 Error: Unable to detect compiler type
#14 28.21     at BuildEnvironment.getKind (/opt/app/node_modules/buildcheck/lib/index.js:115:9)
#14 28.21     at BuildEnvironment.tryCompile (/opt/app/node_modules/buildcheck/lib/index.js:537:15)
#14 28.21     at BuildEnvironment.checkHeader (/opt/app/node_modules/buildcheck/lib/index.js:423:25)
#14 28.21     at Object.<anonymous> (/opt/app/node_modules/cpu-features/buildcheck.js:16:4)
#14 28.21     at Module._compile (node:internal/modules/cjs/loader:1159:14)
#14 28.21     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
#14 28.21     at Module.load (node:internal/modules/cjs/loader:1037:32)
#14 28.21     at Module._load (node:internal/modules/cjs/loader:878:12)
#14 28.21     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
#14 28.21     at node:internal/main/run_main_module:23:47
#14 28.21 
#14 28.21 Node.js v18.12.1"
#14 28.21 info This module is OPTIONAL, you can safely ignore this error
#14 30.26 info This module is OPTIONAL, you can safely ignore this error
#14 30.26 warning Error running install script for optional dependency: "/opt/app/node_modules/@semate
xt/gc-stats: Command failed.
#14 30.26 Exit code: 1
#14 30.26 Command: npx node-pre-gyp install --fallback-to-build
#14 30.26 Arguments: 
#14 30.26 Directory: /opt/app/node_modules/@sematext/gc-stats
#14 30.26 Output:
#14 30.26 node-pre-gyp info it worked if it ends with ok
#14 30.26 node-pre-gyp info using node-pre-gyp@1.0.10
#14 30.26 node-pre-gyp info using node@18.12.1 | linux | arm64
#14 30.26 node-pre-gyp info check checked for \"/opt/app/node_modules/@sematext/gc-stats/build/gcstats
/v1.5.8/Release/node-v108-linux-arm64-musl/gcstats.node\" (not found)
#14 30.26 node-pre-gyp http GET https://github.com/adnanrahic/node-gcstats/archive/refs/tags/1.5.8.tar
.gz
#14 30.26 node-pre-gyp ERR! install response status 404 Not Found on https://github.com/adnanrahic/nod
e-gcstats/archive/refs/tags/1.5.8.tar.gz 
#14 30.26 node-pre-gyp WARN Pre-built binaries not installable for @sematext/gc-stats@1.5.8 and node@1
8.12.1 (node-v108 ABI, musl) (falling back to source compile with node-gyp) 
#14 30.26 node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/adnanrahic/n
ode-gcstats/archive/refs/tags/1.5.8.tar.gz 
#14 30.26 gyp info it worked if it ends with ok
#14 30.26 gyp info using node-gyp@9.1.0
#14 30.26 gyp info using node@18.12.1 | linux | arm64
#14 30.26 gyp info ok 
#14 30.26 gyp info it worked if it ends with ok
#14 30.26 gyp info using node-gyp@9.1.0
#14 30.26 gyp info using node@18.12.1 | linux | arm64
#14 30.26 gyp ERR! find Python 
#14 30.26 gyp ERR! find Python Python is not set from command line or npm configuration
#14 30.26 gyp ERR! find Python Python is not set from environment variable PYTHON
#14 30.26 gyp ERR! find Python checking if \"python3\" can be used
#14 30.26 gyp ERR! find Python - \"python3\" is not in PATH or produced an error
#14 30.26 gyp ERR! find Python checking if \"python\" can be used
#14 30.26 gyp ERR! find Python - \"python\" is not in PATH or produced an error
#14 30.26 gyp ERR! find Python 
#14 30.26 gyp ERR! find Python **********************************************************
#14 30.26 gyp ERR! find Python You need to install the latest version of Python.
#14 30.26 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#14 30.26 gyp ERR! find Python you can try one of the following options:
#14 30.26 gyp ERR! find Python - Use the switch --python=\"/path/to/pythonexecutable\"
#14 30.26 gyp ERR! find Python   (accepted by both node-gyp and npm)
#14 30.26 gyp ERR! find Python - Set the environment variable PYTHON
#14 30.26 gyp ERR! find Python - Set the npm configuration variable python:
#14 30.26 gyp ERR! find Python   npm config set python \"/path/to/pythonexecutable\"
#14 30.26 gyp ERR! find Python For more information consult the documentation at:
#14 30.26 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#14 30.26 gyp ERR! find Python **********************************************************
#14 30.26 gyp ERR! find Python 
#14 30.26 gyp ERR! configure error 
#14 30.26 gyp ERR! stack Error: Could not find any Python installation to use
#14 30.26 gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-g
yp/lib/find-python.js:330:47)
#14 30.26 gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/n
ode-gyp/lib/find-python.js:159:21)
#14 30.26 gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules
/node-gyp/lib/find-python.js:202:16)
#14 30.26 gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_mo
dules/node-gyp/lib/find-python.js:294:16)
#14 30.26 gyp ERR! stack     at exithandler (node:child_process:420:5)
#14 30.26 gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:432:5)
#14 30.26 gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#14 30.26 gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:289:12)
#14 30.26 gyp ERR! stack     at onErrorNT (node:internal/child_process:476:16)
#14 30.26 gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:8
2:21)
#14 30.26 gyp ERR! System Linux 5.15.49-linuxkit
#14 30.26 gyp ERR! command \"/usr/local/bin/node\" \"/usr/local/lib/node_modules/npm/node_modules/node
-gyp/bin/node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--module=/opt/app/node_modules/@sematex
t/gc-stats/build/gcstats/v1.5.8/Release/node-v108-linux-arm64-musl/gcstats.node\" \"--module_name=gcst
ats\" \"--module_path=/opt/app/node_modules/@sematext/gc-stats/build/gcstats/v1.5.8/Release/node-v108-
linux-arm64-musl\" \"--napi_version=8\" \"--node_abi_napi=napi\" \"--napi_build_version=0\" \"--node_n
api_label=node-v108\"
#14 30.26 gyp ERR! cwd /opt/app/node_modules/@sematext/gc-stats
#14 30.26 gyp ERR! node -v v18.12.1
#14 30.26 gyp ERR! node-gyp -v v9.1.0
#14 30.26 gyp ERR! not ok 
#14 30.26 node-pre-gyp ERR! build error 
#14 30.26 node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_mo
dules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/opt/app/node_m
odules/@sematext/gc-stats/build/gcstats/v1.5.8/Release/node-v108-linux-arm64-musl/gcstats.node --modul
e_name=gcstats --module_path=/opt/app/node_modules/@sematext/gc-stats/build/gcstats/v1.5.8/Release/nod
e-v108-linux-arm64-musl --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label
=node-v108' (1)
#14 30.26 node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/opt/app/node_modules/@mapbox/node-
pre-gyp/lib/util/compile.js:89:23)
#14 30.26 node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#14 30.26 node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
#14 30.26 node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:
5)
#14 30.26 node-pre-gyp ERR! System Linux 5.15.49-linuxkit
#14 30.26 node-pre-gyp ERR! command \"/usr/local/bin/node\" \"/opt/app/node_modules/@sematext/gc-stats
/node_modules/.bin/node-pre-gyp\" \"install\" \"--fallback-to-build\"
#14 30.26 node-pre-gyp ERR! cwd /opt/app/node_modules/@sematext/gc-stats
#14 30.26 node-pre-gyp ERR! node -v v18.12.1
#14 30.26 node-pre-gyp ERR! node-pre-gyp -v v1.0.10
#14 30.26 node-pre-gyp ERR! not ok 
#14 30.26 Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp
/bin/node-gyp.js configure --fallback-to-build --module=/opt/app/node_modules/@sematext/gc-stats/build
/gcstats/v1.5.8/Release/node-v108-linux-arm64-musl/gcstats.node --module_name=gcstats --module_path=/o
pt/app/node_modules/@sematext/gc-stats/build/gcstats/v1.5.8/Release/node-v108-linux-arm64-musl --napi_
version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)

Environment

Runtime OS: Custom Linux from the source running armv7 or arm64 architecture Runtime Node.js version: 18.12.1 (also tried v16, but it has not worked either)

sinnrrr commented 1 year ago

I believe this is a problem with properly naming the destination build folder, it expects the folder to be named node-v93-linux-arm-unknown, however, the name is node-v93-linux-arm-glibc (something like this, I don't quite remember, need to re-check)