Skip to content

Failed to Run node-gyp rebuild Needed for gopherjs test on Linux #809

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

Closed
norunners opened this issue Apr 28, 2018 · 5 comments · Fixed by #810
Closed

Failed to Run node-gyp rebuild Needed for gopherjs test on Linux #809

norunners opened this issue Apr 28, 2018 · 5 comments · Fixed by #810

Comments

@norunners
Copy link

I'm having trouble running gopherjs test on my Linux box. It works fine on my Mac after going through the system call setup. https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md

Failure output

> $ pwd
/home/norunners/poc/vert/src/github.com/gopherjs/gopherjs/node-syscall

> $ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.0.0 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/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/norunners/poc/vert/src/github.com/gopherjs/gopherjs/node-syscall/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/norunners/.node-gyp/10.0.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/norunners/.node-gyp/10.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/norunners/.node-gyp/10.0.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/norunners/poc/vert/src/github.com/gopherjs/gopherjs/node-syscall',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/norunners/poc/vert/src/github.com/gopherjs/gopherjs/node-syscall/build'
  CXX(target) Release/obj.target/syscall/syscall.o
../syscall.cc: In function ‘intptr_t toNative(v8::Local<v8::Value>)’:
../syscall.cc:28:35: error: ‘class v8::Array’ has no member named ‘CloneElementAt’
       native[i] = toNative(array->CloneElementAt(i));
                                   ^~~~~~~~~~~~~~
make: *** [syscall.target.mk:93: Release/obj.target/syscall/syscall.o] Error 1
make: Leaving directory '/home/norunners/poc/vert/src/github.com/gopherjs/gopherjs/node-syscall/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 4.16.4-1-ARCH
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/norunners/poc/vert/src/github.com/gopherjs/gopherjs/node-syscall
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Test Failure:

> $ pwd
/home/norunners/poc/vert/src/github.com/norunners/vert

> $ gopherjs test
PASS
fatal error: all goroutines are asleep - deadlock!
FAIL	github.com/norunners/vert	0.790s

Additional Info:

> $ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/norunners/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/norunners/poc/vert"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build058352341=/tmp/go-build -gno-record-gcc-switches"

> $ which python
/usr/bin/python

> $ python --version
Python 2.7.14
@myitcv
Copy link
Member

myitcv commented Apr 28, 2018

Those steps work for me, but I notice you're using node@10.0.0; I'm currently using node@9.10.0.

Interestingly, with 9.10.0 I get a deprecation warning where you get an error:

make: Entering directory '/home/myitcv/gostuff/src/github.com/gopherjs/gopherjs/node-syscall/build'
  CXX(target) Release/obj.target/syscall/syscall.o
../syscall.cc: In function ‘intptr_t toNative(v8::Local<v8::Value>)’:
../syscall.cc:28:51: warning: ‘v8::Local<v8::Object> v8::Array::CloneElementAt(uint32_t)’ is deprecated: Cloning is not supported. [-Wdeprecated-declarations]
       native[i] = toNative(array->CloneElementAt(i));
                                                   ^
In file included from /home/myitcv/.node-gyp/9.10.0/include/node/v8.h:26:0,
                 from /home/myitcv/.node-gyp/9.10.0/include/node/node.h:63,
                 from ../syscall.cc:2:
/home/myitcv/.node-gyp/9.10.0/include/node/v8.h:3562:31: note: declared here
                 Local<Object> CloneElementAt(uint32_t index));
                               ^
/home/myitcv/.node-gyp/9.10.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/syscall.node
  COPY Release/syscall.node
make: Leaving directory '/home/myitcv/gostuff/src/github.com/gopherjs/gopherjs/node-syscall/build'
gyp info ok

I'm assuming you can use something pre 10.0.0 for now?

@norunners
Copy link
Author

@myitcv Thank you sir, downgrading the nodejs package version allowed node-gyp rebuild to finally succeed! We should still keep this open since it should work with the latest version of nodejs or for at least documentation purposes.

> $ node --version
v9.9.0

@myitcv
Copy link
Member

myitcv commented Apr 29, 2018

@norunners I've just pushed up #810 to try and fix this so that GopherJS can be used with Node >= 10.0.0.

The build is now running; all looks fine for now, but in the meantime could you perhaps give it a try locally?

cd $(go list -f '{{.Dir}}' github.com/gopherjs/gopherjs) && \
  git fetch origin pull/810/head && \
  git checkout FETCH_HEAD && \
  go install

Then get Node 10.0.0 installed and follow the instructions as you linked to before: https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md#nodejs-on-linux-and-macos.

Thanks

@norunners
Copy link
Author

norunners commented Apr 29, 2018

@myitcv Awesome work! After installing your change and upgrading my nodejs package to latest, both node-gyp rebuild and gopherjs test succeeded.

However, I did see a regression in gopherjs test after installing your change but before upgrading node. So it may not be compatible with nodejs package version less than v10.0.0.

> $ node --version
v10.0.0

@myitcv
Copy link
Member

myitcv commented Apr 29, 2018

Awesome work

More just hacked it to make it work 👍

My C++ is ropey at best.

dmitshur pushed a commit that referenced this issue Jun 28, 2018
Update Node.js version to 10.0.0.

CloneElementAt has been deprecated and removed in Node.js 10.0.0.
Replace it with Get, which is sufficient here.

Fixes #809.
dmitshur added a commit that referenced this issue Jun 28, 2018
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.

2 participants