nwjs / nw-gyp

native addon build tool for node-webkit
MIT License
195 stars 50 forks source link

nw-gyp rebuild --target=0.18.1 ERR! build error #98

Open maltheism opened 7 years ago

maltheism commented 7 years ago

nw-gyp rebuild for v0.18.1 fails on rebuild for module robotjs and I tested nw-gyp rebuild for v0.14.7 and it doesn't fail.

Steps to reproduce on macOS 10.12 with nwjs-sdk-v0.18.1-osx-x64

cd node_modules/robotjs sudo nw-gyp configure --target=0.18.1 sudo nw-gyp rebuild --target=0.18.1

gyp info it worked if it ends with ok
gyp info using nw-gyp@3.4.0
gyp info using node@6.8.1 | darwin | x64
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/nw-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   '/Users/intralizee/Development/GitHub/Private/nodejs/Lyrics.fish/node_modules/robotjs/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/nw-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/intralizee/.nw-gyp/0.18.1/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/intralizee/.nw-gyp/0.18.1',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/nw-gyp',
gyp info spawn args   '-Dnode_lib_file=nw.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/intralizee/Development/GitHub/Private/nodejs/Lyrics.fish/node_modules/robotjs',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '-Dv13=1',
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' ]
  CXX(target) Release/obj.target/robotjs/src/robotjs.o
In file included from ../src/robotjs.cc:1:
In file included from /Users/intralizee/.nw-gyp/0.18.1/src/node.h:42:
/Users/intralizee/.nw-gyp/0.18.1/deps/v8/include/v8.h:3462:26: error: no member named 'unique_ptr' in namespace
      'std'
  typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule;
                    ~~~~~^
/Users/intralizee/.nw-gyp/0.18.1/deps/v8/include/v8.h:3462:37: error: expected expression
  typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule;
                                    ^
/Users/intralizee/.nw-gyp/0.18.1/deps/v8/include/v8.h:3462:53: error: expected member name or ';' after
      declaration specifiers
  typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule;
  ~~~~~~~                                           ^
/Users/intralizee/.nw-gyp/0.18.1/deps/v8/include/v8.h:3464:3: error: unknown type name 'SerializedModule'
  SerializedModule Serialize();
  ^
/Users/intralizee/.nw-gyp/0.18.1/deps/v8/include/v8.h:3466:31: error: unknown type name 'SerializedModule'
      Isolate* isolate, const SerializedModule& serialized_data);
                              ^
5 errors generated.
make: *** [Release/obj.target/robotjs/src/robotjs.o] Error 1
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/nw-gyp/lib/build.js:294:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/nw-gyp" "rebuild" "--target=0.18.1"
gyp ERR! cwd /Users/intralizee/Development/GitHub/Private/nodejs/Lyrics.fish/node_modules/robotjs
gyp ERR! node -v v6.8.1
gyp ERR! nw-gyp -v v3.4.0
gyp ERR! not ok 
maltheism commented 7 years ago

Anyone that has this issue can checkout this discussion for alternative branch that works. Link: https://github.com/octalmage/robotjs/issues/243

Still not sure what the issue is for the master branch not working.

ghostoy commented 7 years ago

It only happens for latest macOS. The root cause is macOS is deprecating libstdc++ and in favor of libc++. Mixed use of both two libraries will cause such oddballs. See nodejs/node-gyp#469.

Currently a workaround is to change all links to libstdc++ in binding.gyp to libc++, and change MACOSX_DEPLOYMENT_TARGET to 10.9.