Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building in a docker container fails because of node-gyp --jobs max #826

Closed
aiham opened this issue Sep 23, 2021 · 0 comments · Fixed by #827
Closed

Building in a docker container fails because of node-gyp --jobs max #826

aiham opened this issue Sep 23, 2021 · 0 comments · Fixed by #827

Comments

@aiham
Copy link
Contributor

aiham commented Sep 23, 2021

I'm trying to install opencv4nodejs with opencv 4.3.0 in a docker container. I think it's failing because it's trying to run node-gyp using multiple cores which is not working inside the container for some reason. I fixed the issue by changing the --jobs max argument for node-gyp to --jobs 1 on this line:

https://github.com/justadudewhohacks/opencv4nodejs/blob/master/install/install.js#L80

This is the Dockerfile for the container:

FROM node:14-bullseye

RUN apt-get update && \
    apt-get install -y build-essential && \
    apt-get install -y --no-install-recommends cmake && \
    rm -rf /var/lib/apt/lists/*

ENV OPENCV4NODEJS_AUTOBUILD_FLAGS="-DBUILD_LIST=core,imgproc,imgcodecs,videoio,highgui,video,calib3d,features2d,objdetect,dnn,ml,flann,photo,stitching,xfeatures2d"
ENV OPENCV4NODEJS_AUTOBUILD_OPENCV_VERSION="4.3.0"

# Enable verbose mode for node-gyp
# https://stackoverflow.com/a/19074181/545726
ENV V=1

WORKDIR /app
ADD package.json package-lock.json /app/

RUN npm install

Error Message

There's no clear error message, it compiles a few files then after Release/obj.target/opencv4nodejs/cc/core/HistAxes.o it gets stuck then terminates:

  g++ '-DNODE_GYP_MODULE_NAME=opencv4nodejs' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENCV4NODEJS_FOUND_LIBRARY_CORE' '-DOPENCV4NODEJS_FOUND_LIBRARY_HIGHGUI' '-DOPENCV4NODEJS_FOUND_LIBRARY_IMGCODECS' '-DOPENCV4NODEJS_FOUND_LIBRARY_IMGPROC' '-DOPENCV4NODEJS_FOUND_LIBRARY_FEATURES2D' '-DOPENCV4NODEJS_FOUND_LIBRARY_CALIB3D' '-DOPENCV4NODEJS_FOUND_LIBRARY_PHOTO' '-DOPENCV4NODEJS_FOUND_LIBRARY_OBJDETECT' '-DOPENCV4NODEJS_FOUND_LIBRARY_ML' '-DOPENCV4NODEJS_FOUND_LIBRARY_VIDEO' '-DOPENCV4NODEJS_FOUND_LIBRARY_VIDEOIO' '-DOPENCV4NODEJS_FOUND_LIBRARY_DNN' '-DOPENCV4NODEJS_FOUND_LIBRARY_XFEATURES2D' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/14.17.6/include/node -I/root/.cache/node-gyp/14.17.6/src -I/root/.cache/node-gyp/14.17.6/deps/openssl/config -I/root/.cache/node-gyp/14.17.6/deps/openssl/openssl/include -I/root/.cache/node-gyp/14.17.6/deps/uv/include -I/root/.cache/node-gyp/14.17.6/deps/zlib -I/root/.cache/node-gyp/14.17.6/deps/v8/include -I/app/node_modules/opencv-build/opencv/build/include -I/app/node_modules/opencv-build/opencv/build/include/opencv4 -I../cc -I../cc/core -I../../nan -I/app/node_modules/native-node-utils/src  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -std=c++11 -O3 -fno-omit-frame-pointer -std=gnu++1y -MMD -MF ./Release/.deps/Release/obj.target/opencv4nodejs/cc/core/HistAxes.o.d.raw   -c -o Release/obj.target/opencv4nodejs/cc/core/HistAxes.o ../cc/core/HistAxes.cc
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make: *** [opencv4nodejs.target.mk:242: Release/obj.target/opencv4nodejs/cc/opencv4nodejs.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory '/app/node_modules/opencv4nodejs/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.10.25-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--jobs" "max"
gyp ERR! cwd /app/node_modules/opencv4nodejs
gyp ERR! node -v v14.17.6
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

Auto Build - Full Error Log

See attached full error log.

20210923-opencv4nodejs-error-log.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant