When I try to compile a JS package that depends on node-gyp, I end up with this:
root@tx8p-ml81:~/.node-red# npm install @lz129/node-red-contrib-can
npm ERR! code 1
npm ERR! path /root/.node-red/node_modules/socketcan
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/root/.node-red/node_modules/socketcan/build'
npm ERR! CXX(target) Release/obj.target/can/native/can.o
npm ERR! make: Leaving directory '/root/.node-red/node_modules/socketcan/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | arm64
npm ERR! gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/root/.node-red/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.node-red/node_modules/socketcan/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.node-red/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.cache/node-gyp/18.16.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.16.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/root/.node-red/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.16.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/root/.node-red/node_modules/socketcan',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! aarch64-poky-linux-cpp: fatal error: '-c' is not a valid option to the preprocessor
npm ERR! compilation terminated.
npm ERR! make: *** [can.target.mk:107: Release/obj.target/can/native/can.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/root/.node-red/node_modules/node-gyp/lib/build.js:216:23)
npm ERR! gyp ERR! System Linux 6.1.36-karo+g559356621806
npm ERR! gyp ERR! command "/usr/bin/node" "/root/.node-red/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /root/.node-red/node_modules/socketcan
npm ERR! gyp ERR! node -v v18.16.1
npm ERR! gyp ERR! node-gyp -v v10.2.0
npm ERR! gyp ERR! not ok
When I try to compile a basic hello world cpp, it seems to dump what looks like the preprocessor output and not an actual binary.
Using the -c flag gives the same output as the previously mentioned error.
I feel like I am missing something to install the full cpp compiler I’ve got:
IMAGE_INSTALL:append = "systemd apt openssh vim networkmanager sudo
git curl wget rfkill gnupg openssl nodejs python3 node-red
nodejs-npm python3-pip make cmake gcc libgcc gcc-sanitizers
binutils libiio linux-imx-headers g++"
but there has to be something missing, I’ve tried adding gcc-runtime
but then bitbake says there are no buildable providers, but its in the same folder as gcc.
Does anyone know what I am missing?