octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.37k stars 961 forks source link

Unable to install robotjs in Docker image Centos/Ubuntu/Linux #606

Open deepziem opened 4 years ago

deepziem commented 4 years ago

Trying to do npm install in Linux image inside Docker in a mac. Unable to install. Getting errors in most combinations.

Tried various versions of Linux, Nodejs < 12 and > 12 versions.

Step 9/27 : RUN node --version                                                                                                                                                               
 ---> Running in ...                                                                                                                                                                
v11.15.0                                                                                                                                                                                     
Removing intermediate container ...                                                                                                                                                    
Step 10/27 : RUN npm -v                                                                                                                                                                      
 ---> Running in..                                                                                                                                                         
6.7.0                  

Should install

Does not install and fails with this error

Reproduce - copy package.json from mac to linux in Docker. Npm install

> robotjs@0.6.0 install xxx.....nodemodulesfolder/robotjs
> prebuild-install || node-gyp rebuild

prebuild-install WARN install self signed certificate in certificate chain
make: Entering directory `xxx.....nodemodulesfolder/robotjs/build'
  CXX(target) Release/obj.target/robotjs/src/robotjs.o
cc1plus: warning: command line option '-Wbad-function-cast' is valid for C/ObjC but not for C++ [enabled by default]
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:290,
                 from ../src/robotjs.cc:2:
../../nan/nan_implementation_12_inl.h: In function 'void InitAll(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)':
../../nan/nan_implementation_12_inl.h:119:1: warning: inlining failed in call to 'static Nan::imp::FactoryBase<v8::FunctionTemplate>::return_t Nan::imp::Factory<v8::FunctionTemplate>::_ZN3Nan3imp7FactoryIN2v816FunctionTemplateEE3NewEPFvRKNS_20FunctionCallbackInfoINS2_5ValueEEEENS2_5LocalIS6_EENSC_INS2_9SignatureEEE.constprop.30(Nan::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>)': --param large-function-growth limit reached [-Winline]
 Factory<v8::FunctionTemplate>::New( FunctionCallback callback
 ^
In file included from ../../nan/nan.h:290:0,
                 from ../src/robotjs.cc:2:
../../nan/nan_new.h:239:47: warning: called from here [-Winline]
     return imp::Factory<T>::New(callback, data);
                                               ^
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:290,
                 from ../src/robotjs.cc:2:
../../nan/nan_implementation_12_inl.h:119:1: warning: inlining failed in call to 'static Nan::imp::FactoryBase<v8::FunctionTemplate>::return_t Nan::imp::Factory<v8::FunctionTemplate>::_ZN3Nan3imp7FactoryIN2v816FunctionTemplateEE3NewEPFvRKNS_20FunctionCallbackInfoINS2_5ValueEEEENS2_5LocalIS6_EENSC_INS2_9SignatureEEE.constprop.30(Nan::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>)': --param large-function-growth limit reached [-Winline]
 Factory<v8::FunctionTemplate>::New( FunctionCallback callback
 ^
In file included from ../../nan/nan.h:290:0,
                 from ../src/robotjs.cc:2:
../../nan/nan_new.h:239:47: warning: called from here [-Winline]
     return imp::Factory<T>::New(callback, data);
                                               ^
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:290,
                 from ../src/robotjs.cc:2:
../../nan/nan_implementation_12_inl.h:119:1: warning: inlining failed in call to 'static Nan::imp::FactoryBase<v8::FunctionTemplate>::return_t Nan::imp::Factory<v8::FunctionTemplate>::_ZN3Nan3imp7FactoryIN2v816FunctionTemplateEE3NewEPFvRKNS_20FunctionCallbackInfoINS2_5ValueEEEENS2_5LocalIS6_EENSC_INS2_9SignatureEEE.constprop.30(Nan::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>)': --param large-function-growth limit reached [-Winline]
 Factory<v8::FunctionTemplate>::New( FunctionCallback callback
 ^
In file included from ../../nan/nan.h:290:0,
                 from ../src/robotjs.cc:2:
../../nan/nan_new.h:239:47: warning: called from here [-Winline]
     return imp::Factory<T>::New(callback, data);
                                               ^
../src/robotjs.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE keyToggle(Nan::NAN_METHOD_ARGS_TYPE)':
../src/robotjs.cc:592:34: warning: 'down' may be used uninitialized in this function [-Wmaybe-uninitialized]
    toggleKeyCode(key, down, flags);
                                  ^
  CC(target) Release/obj.target/robotjs/src/deadbeef_rand.o
  CC(target) Release/obj.target/robotjs/src/mouse.o
  CC(target) Release/obj.target/robotjs/src/keypress.o
../src/keypress.c: In function 'typeString':
../src/keypress.c:259:41: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
  #define toggleUniKey(c, down) toggleKey(c, down, MOD_NONE)
                                         ^
../src/keypress.c:274:16: note: 'n' was declared here
  unsigned long n;
                ^
  CC(target) Release/obj.target/robotjs/src/keycode.o
  CC(target) Release/obj.target/robotjs/src/screen.o
  CC(target) Release/obj.target/robotjs/src/screengrab.o
  CC(target) Release/obj.target/robotjs/src/snprintf.o
../src/snprintf.c: In function 'portable_vsnprintf':
../src/snprintf.c:557:33: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       size_t n = !q ? strlen(p) : (q-p);
                                 ^
../src/snprintf.c:704:40: warning: signed and unsigned type in conditional expression [-Wsign-compare]
             str_arg_l = !q ? precision : (q-str_arg);
                                        ^
../src/snprintf.c:943:62: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             fast_memset(str+str_l, (zero_padding?'0':' '), (n>avail?avail:n));
                                                              ^
../src/snprintf.c:372:35: note: in definition of macro 'fast_memset'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:943:74: warning: signed and unsigned type in conditional expression [-Wsign-compare]
             fast_memset(str+str_l, (zero_padding?'0':' '), (n>avail?avail:n));
                                                                          ^
../src/snprintf.c:372:35: note: in definition of macro 'fast_memset'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:960:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             fast_memcpy(str+str_l, str_arg, (n>avail?avail:n));
                                               ^
../src/snprintf.c:365:35: note: in definition of macro 'fast_memcpy'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:960:59: warning: signed and unsigned type in conditional expression [-Wsign-compare]
             fast_memcpy(str+str_l, str_arg, (n>avail?avail:n));
                                                           ^
../src/snprintf.c:365:35: note: in definition of macro 'fast_memcpy'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:969:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             fast_memset(str+str_l, '0', (n>avail?avail:n));
                                           ^
../src/snprintf.c:372:35: note: in definition of macro 'fast_memset'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:969:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
             fast_memset(str+str_l, '0', (n>avail?avail:n));
                                                       ^
../src/snprintf.c:372:35: note: in definition of macro 'fast_memset'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:981:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                         (n>avail?avail:n));
                           ^
../src/snprintf.c:365:35: note: in definition of macro 'fast_memcpy'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:981:39: warning: signed and unsigned type in conditional expression [-Wsign-compare]
                         (n>avail?avail:n));
                                       ^
../src/snprintf.c:365:35: note: in definition of macro 'fast_memcpy'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:992:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             fast_memset(str+str_l, ' ', (n>avail?avail:n));
                                           ^
../src/snprintf.c:372:35: note: in definition of macro 'fast_memset'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:992:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
             fast_memset(str+str_l, ' ', (n>avail?avail:n));
                                                       ^
../src/snprintf.c:372:35: note: in definition of macro 'fast_memset'
   { register size_t nn = (size_t)(n); \
                                   ^
../src/snprintf.c:564:19: warning: variable 'starting_p' set but not used [-Wunused-but-set-variable]
       const char *starting_p;
                   ^
../src/snprintf.c:369:48: warning: 'str_arg' may be used uninitialized in this function [-Wmaybe-uninitialized]
       for (ss=(s), dd=(d); nn>0; nn--) *dd++ = *ss++; } }
                                                ^
../src/snprintf.c:573:19: note: 'str_arg' was declared here
       const char *str_arg;      /* string address in case of string argument */
                   ^
  CC(target) Release/obj.target/robotjs/src/MMBitmap.o
  CC(target) Release/obj.target/robotjs/src/xdisplay.o
../src/xdisplay.c: In function 'setXDisplay':
../src/xdisplay.c:53:2: warning: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]
  displayName = strdup(name);
  ^
../src/xdisplay.c:53:16: warning: incompatible implicit declaration of built-in function 'strdup' [enabled by default]
  displayName = strdup(name);
                ^
  SOLINK_MODULE(target) Release/obj.target/robotjs.node
  COPY Release/robotjs.node
make: Leaving directory `xxx.....nodemodulesfolder/robotjs/build'

> core-js@2.6.11 postinstall xxx.....nodemodulesfolder/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> @angular/cli@8.0.6 postinstall xxx.....nodemodulesfolder/@angular/cli
> node ./bin/postinstall/script.js

> husky@3.0.7 postinstall xxx.....nodemodulesfolder/husky
> opencollective-postinstall || exit 0

Your Environment

Programmnix commented 4 years ago

Hello @deepziem ,

I build my electron app with robotjs inside a docker file and its working. Here my example dockerfile:

FROM nikolaik/python-nodejs:python3.7-nodejs12-stretch
RUN apt update -y && apt install -y libxtst-dev libpng++-dev make gcc
RUN mkdir test
WORKDIR /root/test 
RUN npm init --yes
RUN npm install robotjs
deepziem commented 4 years ago

actually has the same error ..

RUN apt-get install libxtst-dev libpng++-dev make gcc --assume-yes

Even then tried to run it .. this error happened

https://github.com/octalmage/robotjs/issues/614
jacobkim9881 commented 3 years ago

Hope you try this