opencv4nodejs icon indicating copy to clipboard operation
opencv4nodejs copied to clipboard

Unable to build in Ubuntu 22.04 - execv: Argument list too long

Open zzz08900 opened this issue 1 year ago • 5 comments

Is there some compatibility issue with node-gyp or gcc?

error /home/andrew/testProject/node_modules/@u4/opencv4nodejs: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /home/andrew/testProject/node_modules/@u4/opencv4nodejs
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"

gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/home/andrew/testProject/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 '/home/andrew/testProject/node_modules/@u4/opencv4nodejs/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/andrew/testProject/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/andrew/.cache/node-gyp/20.14.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=/home/andrew/.cache/node-gyp/20.14.0',
gyp info spawn args '-Dnode_gyp_dir=/home/andrew/testProject/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/andrew/.cache/node-gyp/20.14.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/andrew/testProject/node_modules/@u4/opencv4nodejs',
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: Entering directory '/home/andrew/testProject/node_modules/@u4/opencv4nodejs/build'
  CXX(target) Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o
g++: fatal error: cannot execute ‘/usr/lib/gcc/x86_64-linux-gnu/11/cc1plus’: execv: Argument list too long
compilation terminated.
make: *** [opencv4nodejs.target.mk:10236: Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o] Error 1
make: Leaving directory '/home/andrew/testProject/node_modules/@u4/opencv4nodejs/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/home/andrew/testProject/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Linux 6.5.0-35-generic
gyp ERR! command "/home/andrew/.nvm/versions/node/v20.14.0/bin/node" "/home/andrew/testProject/node_modules/@u4/opencv4nodejs/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/andrew/testProject/node_modules/@u4/opencv4nodejs
gyp ERR! node -v v20.14.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok

zzz08900 avatar Jun 18 '24 07:06 zzz08900

+1

Pnlvfx avatar Jun 25 '24 16:06 Pnlvfx

Can someone help us?

Pnlvfx avatar Jun 27 '24 11:06 Pnlvfx

A quick glance at opencv4nodejs.target.mk indicates somehow output stream of git clone and some other commands ends up pushed into DEFS_Release so this makefile is not going to work.

No idea how/why this happened. Also no idea what is responsible of generating this makefile.

zzz08900 avatar Jul 13 '24 08:07 zzz08900

I've fixed this error by removing OPENCV4NODEJS_DISABLE_AUTOBUILD=1 from the package.json and running:

export OPENCV4NODEJS_DISABLE_AUTOBUILD=1 npm install

It look like it's not reading the package.json environment

Pnlvfx avatar Jul 13 '24 09:07 Pnlvfx

Yeah sure you can install your own openCV and disable auto build all together. But the installation process is kinda painful for some OS and that's why we have all sorts of auto install scripts floating around, from Anaconda to build-opencv.

zzz08900 avatar Jul 13 '24 09:07 zzz08900