clementfarabet / gfx.js

A graphics backend for the browser (with a Torch7 client).
MIT License
125 stars 35 forks source link

Build Error on OS X 10.9.3 #17

Closed gushiapi closed 10 years ago

gushiapi commented 10 years ago

I tried to install gfx.js with the command " sudo luarocks install https://raw.github.com/clementfarabet/gfx.js/master/gfx.js-scm-0.rockspec " but it returns with errors: ==> installing Node.js dependencies

pty.js@0.2.4 install /private/tmp/luarocks_gfx.js-scm-0-1414/gfx.js/node_modules/pty.js node-gyp rebuild

CXX(target) Release/obj.target/pty/src/unix/pty.o ../src/unix/pty.cc:487:10: error: use of undeclared identifier 'openpty' return openpty(amaster, aslave, name, (termios )termp, (winsize )winp); ^ ../src/unix/pty.cc:533:10: error: use of undeclared identifier 'forkpty' return forkpty(amaster, name, (termios )termp, (winsize )winp); ^ 2 errors generated. make: * [Release/obj.target/pty/src/unix/pty.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/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12) gyp ERR! System Darwin 13.2.0 gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /private/tmp/luarocks_gfx.js-scm-0-1414/gfx.js/node_modules/pty.js gyp ERR! node -v v0.10.29 gyp ERR! node-gyp -v v0.13.1 gyp ERR! not ok

ws@0.4.31 install /private/tmp/luarocks_gfx.js-scm-0-1414/gfx.js/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws (node-gyp rebuild 2> builderror.log) || (exit 0)

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o SOLINK_MODULE(target) Release/bufferutil.node SOLINK_MODULE(target) Release/bufferutil.node: Finished CXX(target) Release/obj.target/validation/src/validation.o SOLINK_MODULE(target) Release/validation.node SOLINK_MODULE(target) Release/validation.node: Finished npm ERR! pty.js@0.2.4 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pty.js@0.2.4 install script. npm ERR! This is most likely a problem with the pty.js package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls pty.js npm ERR! There is likely additional logging output above. npm ERR! System Darwin 13.2.0 npm ERR! command "node" "/usr/local/bin/npm" "install" npm ERR! cwd /private/tmp/luarocks_gfx.js-scm-0-1414/gfx.js npm ERR! node -v v0.10.29 npm ERR! npm -v 1.4.14 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /private/tmp/luarocks_gfx.js-scm-0-1414/gfx.js/npm-debug.log npm ERR! not ok code 0 ==> installing static resources into ~/.gfx.js/ ==> installing torch client into /usr/local/bin/../share/lua/5.1/gfx/

It was able to work but today when I tried to reinstalled it, it failed...

Thanks!

lelayf commented 10 years ago

Hi Clément, same here for me. Any idea if we should report it to the owner of pty.js as suggested?

capecodcid commented 10 years ago

I have the same problem as well.

soumith commented 10 years ago

Hey, apparently OSX doesn't ship with the relevant headers, and none of us noticed because we have XCode Commandline Tools installed.

Look at the solution below for pty.js https://github.com/atom/terminal/issues/28#issuecomment-39405908

capecodcid commented 10 years ago

I have command line tools and still have problems with pty.js

npm ERR! pty.js@0.2.4 install: node-gyp rebuild

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the pty.js@0.2.4 install script.

npm ERR! This is most likely a problem with the pty.js package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR! node-gyp rebuild

npm ERR! You can get their info via:

npm ERR! npm owner ls pty.js

npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.2.0

npm ERR! command "node" "/usr/local/bin/npm" "install"

npm ERR! cwd /private/tmp/luarocks_gfx.js-scm-0-3979/gfx.js

npm ERR! node -v v0.10.29

npm ERR! npm -v 1.4.14

npm ERR! code ELIFECYCLE

npm ERR!

npm ERR! Additional logging details can be found in:

npm ERR! /private/tmp/luarocks_gfx.js-scm-0-3979/gfx.js/npm-debug.log

npm ERR! not ok code 0

Thank you for your help.

-Andrew

On Sat, Jun 28, 2014 at 1:09 PM, Soumith Chintala notifications@github.com wrote:

Hey, apparently OSX doesn't ship with the relevant headers, and none of us noticed because we have XCode Commandline Tools installed. atom/terminal#28 (comment) https://github.com/atom/terminal/issues/28#issuecomment-39405908

— Reply to this email directly or view it on GitHub https://github.com/clementfarabet/gfx.js/issues/17#issuecomment-47433017 .

Andrew Hartnett Couzin Lab 508-566-2206 ahartnet@princeton.edu

lelayf commented 10 years ago

I finally managed to run it on Mac OS X 10.9.3 (Mavericks), Node v0.10.29, npm 1.4.16, node-gyp 0.13.1. I have XCode installed but nevertheless downloaded and installed the Command Line Developer Tools from apple dev website.

The compilation error is due to util.h (which declares openpty and forkpty) not being properly included in required pty.js module. So I cloned https://github.com/chjj/pty.js and edited src/unix/pty.cc at line 39 to replace #include <util.h> by #include "/usr/include/util.h" in the conditional inclusions header. Then still in pty.js :

npm install nan
npm install extend
make

then I copied the entire pty.js directory under gfx.js/mode_modules. Then in gfx.js :

sudo luarocks make

At this point the compile error should be gone. When launching luajit -lgxf.go I had a few critical lua dependencies missing, I installed them with luarocks :

sudo luarocks install dok
sudo luarocks install lua-cjson

Finally ran luajit -lgfx.go which actually loads the torch repl and launches the server on port 8000. Nice!

soumith commented 10 years ago

@lelayf thanks a lot for the investigation, I am going to make this more permanent by sending in a PR that uses your tricks.

soumith commented 10 years ago

I think it makes more sense to get the pty.js project to fix itself first, but wrt luarocks dependencies, we can do something immediately about it.

capecodcid commented 10 years ago

Thank you Francois!

Your fix worked for me as well!

Cheers, Andrew

On Mon, Jun 30, 2014 at 10:25 AM, François Le Lay notifications@github.com wrote:

I finally managed to run it on Mac OS X 10.9.3 (Mavericks), Node v0.10.29, npm 1.4.16, node-gyp 0.13.1. I have XCode installed and but nevertheless downloaded and installed the Command Line Developer Tools from apple dev website.

The compilation error is due to util.h (which declares openpty and forkpty) not being properly included in required pty.js module. So I cloned https://github.com/chjj/pty.js and edited src/unix/pty.cc at line 39 to replace #include by #include "/usr/include/util.h" in the conditional inclusions header. Then still in pty.js :

npm install nan npm install extend make

then I copied the entire pty.js directory under gfx.js/mode_modules.

sudo luarocks make

At this point the compile error should be gone. When launching luajit -lgxf.go I had a few critical lua dependencies missing, I installed them with luarocks :

sudo luarocks install dok sudo luarocks install lua-cjson

Finally ran luajit -lgfx.go which actually loads the torch repl and launches the server on port 8000. Nice!

— Reply to this email directly or view it on GitHub https://github.com/clementfarabet/gfx.js/issues/17#issuecomment-47537686 .

Andrew Hartnett Couzin Lab 508-566-2206 ahartnet@princeton.edu

clementfarabet commented 10 years ago

Awesome, thanks for the fix. @soumith , we should patch both our repo and do a pr to them. I'm not tracking their changes actually, it's been a while since I merged from their repo.

royalstream commented 10 years ago

I'm new to Torch. This may help others in my position, I followed your instructions almost exactly but I had to change some things:

The make command inside pty.js/ fails for me with make[1]: node-waf: No such file or directory so I replaced it with a npm install then I copied the whole thing to .gfx.js/node_modules and then I continued as you described. One more thing, I didn't need to manually install dok nor lua-cjson I'm using Mac OS X 10.9.3

jaidevd commented 10 years ago

Thanks, @lelayf. I was having the exact same issue and your fix worked.

renaud commented 10 years ago

combining responsed from @lelayf and @royalstream :

cd /tmp
git clone https://github.com/chjj/pty.js.git
cd pty.js
vim src/unix/pty.cc

replace #include <util.h> by #include "/usr/include/util.h" on line 39

make
npm install
cp -r pty.js ~/.gfx.js/node_modules/.

cd ~/.gfx.js
luarocks make
luajit -lgfx.go
ghost commented 10 years ago

dear god thank you all for this!
screen shot 2014-08-15 at 8 13 14 pm

ronanmoynihan commented 10 years ago

Hi,

I've tried all the workarounds in this thread and in https://github.com/atom/terminal/issues/28#issuecomment-39405908 but cannot get this to work.

Is there going to be an update to the installation to fix these issues instead of trying to hack it to make it work?

Thanks

vzhong commented 10 years ago

@ronanmoynihan what error are you seeing?

can you try the solution in clementfarabet/gfx.js#22?

export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib/
ronanmoynihan commented 10 years ago

Hi @vzhong, Yes I tried that. I'm getting the error below when running the command luarocks install https://raw.github.com/clementfarabet/gfx.js/master/gfx.js-scm-0.rockspec

2 errors generated. make: *\ [Release/obj.target/pty/src/unix/pty.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/npm/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12) gyp ERR! System Darwin 13.3.0 gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /private/tmp/luarocks_gfx.js-scm-0-7549/gfx.js/node_modules/pty.js gyp ERR! node -v v0.10.30 gyp ERR! node-gyp -v v0.13.1 gyp ERR! not ok

ronanmoynihan commented 10 years ago

When trying to run luajit -lgfx.go I get the error below.

module.js:340 throw err; ^ Error: Cannot find module '../build/Release/pty.node' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (/Users/ronanmoynihan/.gfx.js/node_modules/pty.js/lib/pty.js:10:11) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)

ronanmoynihan commented 10 years ago

@vzhong Sorry I got it working now. I went over the steps again from @royalstream and @lelayf

Thanks.

jakezhaojb commented 10 years ago

Thank you for this wonderful solution! @lelayf

soumith commented 10 years ago

@lelayf thanks for the fix again, I made a PR to gfx.js that would not need people to manually hack this patch up.

synchro-- commented 10 years ago

I still have the same problem. I tried all the workarounds mentioned above but nothing to do :

When trying to run luajit -lgfx.go module.js:338 throw err; ^ Error: Cannot find module '../build/Release/pty.node' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (/home/synchro/.gfx.js/node_modules/pty.js/lib/pty.js:10:11) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17)

synchro-- commented 10 years ago

@ronanmoynihan How did you do? I've got your same error. Nor make neither npm install works in pty.js for me.

soumith commented 10 years ago

Can you just try installing gfx again? I fixed it. Just do luarocks install gfx.js

vishalchandra commented 10 years ago

Still not working. (on Mac OSX)

synchro-- commented 10 years ago

I guess I had some problem with nodejs maybe. I've just reinstalled everything with this simple script I wrote, putting together all the scripts for torch and gfx installation. http://pastebin.com/X0fuvDbx (for Ubuntu) @vishalchandra It just reinstalls torch deps, luajit, etc and then it does " luarocks install gfx.js" just like soumith said. For me it's ok, it works perfectly. thanks @soumith

vishalchandra commented 10 years ago

The issue for me was whether command line tools for Xcode are installed or not. Resolved once I did that.

cbasavaraj commented 8 years ago

Hi, is this still an issue in 2016? I am trying to use the t-SNE visualisation here https://github.com/clementfarabet/manifold, which requires gfx.js

luarocks install gfx.js gives me a bunch of errors (& warnings).

Will I be better off using qlua instead of gfx? Thanks a lot for any suggestions.

firstly, ==> installing Node.js dependencies npm WARN package.json gfx.js@0.2.10 No license field.

secondly, CXX(target) Release/obj.target/fse/fsevents.o In file included from ../fsevents.cc:6: ../node_modules/nan/nan.h:339:13: error: no member named 'New' in 'v8::String' return _NAN_ERROR(v8::Exception::Error, errmsg); ^~~~~~~~~~~~ ../node_modules/nan/nan.h:319:50: note: expanded from macro '_NAN_ERROR'

define _NAN_ERROR(fun, errmsg) fun(v8::String::New(errmsg))

                                 ~~~~~~~~~~~~^

../node_modules/nan/nan.h:343:5: error: no member named 'ThrowException' in namespace 'v8' _NAN_THROW_ERROR(v8::Exception::Error, errmsg);

....

ending with fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *\ [Release/obj.target/fse/fsevents.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/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 14.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /private/tmp/luarocks_gfx.js-scm-0-9672/gfx.js/node_modules/fsevents gyp ERR! node -v v4.4.0 gyp ERR! node-gyp -v v3.3.0 gyp ERR! not ok

thirdly, 14 errors generated. make: *\ [Release/obj.target/pty/src/unix/pty.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/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 14.5.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /private/tmp/luarocks_gfx.js-scm-0-9672/gfx.js/node_modules/pty.js gyp ERR! node -v v4.4.0 gyp ERR! node-gyp -v v3.3.0 gyp ERR! not ok npm WARN optional dep failed, continuing fsevents@0.2.0

and finally, CXX(target) Release/obj.target/bufferutil/src/bufferutil.o npm ERR! Darwin 14.5.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v4.4.0 npm ERR! npm v2.14.20 npm ERR! code ELIFECYCLE

npm ERR! pty.js@0.2.4 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pty.js@0.2.4 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the pty.js package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs pty.js npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm ERR! npm owner ls pty.js npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /private/tmp/luarocks_gfx.js-scm-0-9672/gfx.js/npm-debug.log