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

Build fails on OSX #116

Closed
Qix- opened this issue Oct 26, 2015 · 26 comments
Closed

Build fails on OSX #116

Qix- opened this issue Oct 26, 2015 · 26 comments
Assignees

Comments

@Qix-
Copy link

Qix- commented Oct 26, 2015

$ npm --version
3.3.6
$ node --version
v4.1.1
$ node-gyp --version
v3.0.3
$ npm i robotjs
> robotjs@0.3.1 install /src/snip/node_modules/robotjs
> node-gyp rebuild

  CXX(target) Release/obj.target/robotjs/src/robotjs.o
../src/robotjs.cc:2:10: fatal error: 'nan.h' file not found
#include <nan.h>
         ^
1 error generated.
make: *** [Release/obj.target/robotjs/src/robotjs.o] Error 1

I even tried npm i nan on its own to no avail. Running on El Capitan.

@octalmage
Copy link
Owner

Does the nan directory exist in the robotjs node_modules directory?

@Qix-
Copy link
Author

Qix- commented Oct 26, 2015

No, it wouldn't; NPM@3 onward has flat module systems. That could be it. I'm not able to confirm since the build fails, thus robotjs doesn't appear in node_modules to begin with.

@RainmanNoodles
Copy link

FWIW, I'm also seeing the same issue, so it's not an isolated thing. (node 4.2.1/node-gyp 3.0.3/npm 3.3.9 on El Capitan)

@octalmage
Copy link
Owner

Alright, I know what needs to be done. I'll submit a PR.

@octalmage
Copy link
Owner

#117 should resolve this, could you try building RobotJS from the dynamic-nan-include branch?

Thanks!

@RainmanNoodles
Copy link

Using npm install git://github.com/octalmage/robotjs#dynamic-nan-include gives me this error:

Duplicate of Qix's error below, redacted to make the thread cleaner...

I saw this error before when I was running npm 2.x but I upgraded to 3.x and it changed to the nan.h error...

@Qix-
Copy link
Author

Qix- commented Oct 26, 2015

Same thing here.

$ npm i https://github.com/octalmage/robotjs.git\#dynamic-nan-include

> robotjs@0.3.1 install /src/snip/node_modules/robotjs
> node-gyp rebuild

  CXX(target) Release/obj.target/robotjs/src/robotjs.o
../src/robotjs.cc:76:16: error: cannot initialize a variable of type 'MMMouseButton' (aka 'CGMouseButton') with an rvalue of type '_MMMouseButton'
        MMMouseButton button = LEFT_BUTTON;
                      ^        ~~~~~~~~~~~
../src/robotjs.cc:129:16: error: cannot initialize a variable of type 'MMMouseButton' (aka 'CGMouseButton') with an rvalue of type '_MMMouseButton'
        MMMouseButton button = LEFT_BUTTON;
                      ^        ~~~~~~~~~~~
../src/robotjs.cc:397:13: error: assigning to 'MMKeyFlags' (aka 'CGEventFlags') from incompatible type '_MMKeyFlags'
        *flags = MOD_ALT;
               ^ ~~~~~~~
../src/robotjs.cc:401:13: error: assigning to 'MMKeyFlags' (aka 'CGEventFlags') from incompatible type '_MMKeyFlags'
        *flags = MOD_META;
               ^ ~~~~~~~~
../src/robotjs.cc:405:13: error: assigning to 'MMKeyFlags' (aka 'CGEventFlags') from incompatible type '_MMKeyFlags'
        *flags = MOD_CONTROL;
               ^ ~~~~~~~~~~~
../src/robotjs.cc:409:13: error: assigning to 'MMKeyFlags' (aka 'CGEventFlags') from incompatible type '_MMKeyFlags'
        *flags = MOD_SHIFT;
               ^ ~~~~~~~~~
../src/robotjs.cc:413:13: error: assigning to 'MMKeyFlags' (aka 'CGEventFlags') from incompatible type '_MMKeyFlags'
        *flags = MOD_NONE;
               ^ ~~~~~~~~
../src/robotjs.cc:425:13: error: cannot initialize a variable of type 'MMKeyFlags' (aka 'CGEventFlags') with an rvalue of type '_MMKeyFlags'
        MMKeyFlags flags = MOD_NONE;
                   ^       ~~~~~~~~
../src/robotjs.cc:479:13: error: cannot initialize a variable of type 'MMKeyFlags' (aka 'CGEventFlags') with an rvalue of type '_MMKeyFlags'
        MMKeyFlags flags = MOD_NONE;
                   ^       ~~~~~~~~
9 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/npm/node_modules/node-gyp/lib/build.js:270: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 15.0.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 /src/snip/node_modules/robotjs
gyp ERR! node -v v4.1.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "https://github.com/octalmage/robotjs.git#dynamic-nan-include"
npm ERR! node v4.1.1
npm ERR! npm  v3.3.6
npm ERR! code ELIFECYCLE

npm ERR! robotjs@0.3.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the robotjs@0.3.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the robotjs 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 robotjs
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /src/snip/npm-debug.log

@octalmage
Copy link
Owner

Hmm, must be an El Capitan thing. It builds for Node v4.2.1 for me without issue. I'll have to find a way to test and work on this, it may be a couple of days. Sorry!

@jazzzz
Copy link

jazzzz commented Oct 27, 2015

#117 should resolve this, could you try building RobotJS from the dynamic-nan-include branch?

I had the same build error on Windows 10, it is fixed with the dynamic-nan-include branch!

@octalmage
Copy link
Owner

Awesome! I'll get it pushed out today with #114.

@octalmage
Copy link
Owner

I'm so curious what has changed here. Is it the compiler? I feel like it has to be. What version of Xcode are y'all running?

@octalmage
Copy link
Owner

It has to be gcc/g++, here's what I have:

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

What versions do y'all have?

@SimulatedGREG
Copy link

El Capitan 10.11.1 & Xcode 7.1 (7B91b)
xcode-select -v gives me version 2343, if that makes any difference

@octalmage
Copy link
Owner

@SimulatedGREG Could you check your gcc/g++ version?

Thanks a ton!

@SimulatedGREG
Copy link

This?

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

@octalmage
Copy link
Owner

Yes thanks! And could you run g++ -v?

@SimulatedGREG
Copy link

Looks the same...

$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

@octalmage
Copy link
Owner

Hmm, I thought I was on to something. I'll set up an El Capitan VM now.

@Qix-
Copy link
Author

Qix- commented Oct 28, 2015

Hmm, first thought is that you shouldn't be relying upon GNU's compilers on OSX, because they're usually symlinked to clang which can have different semantics. Should be looking at clang/clang++ instead of gcc/g++.

That being said:

$ clang -v
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

@octalmage
Copy link
Owner

Yeah I'm having a hard time imaging exactly what has changed. I don't want to update my main OS and not be able to work on RobotJS, so I'm trying to get a VM going.

@octalmage
Copy link
Owner

And why does Node.js v0.12.7 build? Does node-gyp use different build tools here? I'm looking into this now.

@SimulatedGREG
Copy link

That was my main question, how in the world does v0.12.7 work. Thanks for the fast responses by the way!

Now using system version of node: v0.12.7 (npm v2.11.3)
...
 $ npm install robotjs
-
> robotjs@0.3.1 install /Users/gregholguin/Documents/Projects/Personal/twitch-plays-undertale/node_modules/robotjs
> node-gyp rebuild

  CXX(target) Release/obj.target/robotjs/src/robotjs.o
  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
  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
  CC(target) Release/obj.target/robotjs/src/MMBitmap.o
  SOLINK_MODULE(target) Release/robotjs.node
robotjs@0.3.1 node_modules/robotjs
└── nan@2.1.0

@Qix-
Copy link
Author

Qix- commented Oct 28, 2015

This is why I suspect it's a Nan issue.

@octalmage
Copy link
Owner

Since the original issue has been resolved, I created #118 to address the El Capitan issue.

Thanks for the help guys!

@octalmage
Copy link
Owner

v0.3.2 published to npm which fixes this issue.

@prateekbh
Copy link

same problem is happening on mac os 11.4 node 15.x

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

No branches or pull requests

6 participants