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

install fails on ubuntu #17

Closed
amih opened this issue Mar 12, 2015 · 34 comments
Closed

install fails on ubuntu #17

amih opened this issue Mar 12, 2015 · 34 comments

Comments

@amih
Copy link

amih commented Mar 12, 2015

Edit by octalmage:

If RobotJS fails to build, install these packages:

sudo apt-get install libxtst-dev libpng++-dev

Original comment:
There's an error, some header .h file missing?

solution is to install X developer tools with:

sudo apt-get install xorg-dev

Perhaps add this to the README file.
never mind, doesn't work on Ubuntu :(

@octalmage
Copy link
Owner

So far I've only tested RobotJS on Mac, although technically the code is cross platform. The build script probably needs to be modified.

You we're able to get it installed? What part doesn't work? Do you get any errors?

Thanks!

@amih
Copy link
Author

amih commented Mar 12, 2015

After installing the xorg-dev I successfully installed the robotjs but following the demo resulted in error messages:

> var robot = require("robotjs");
undefined
> var mouse=robot.getMousePos();
node: symbol lookup error: /home/amih3/tmp/node_modules/robotjs/build/Release/robotjs.node: undefined symbol: XGetMainDisplay

I hope this helps, thank you!

@octalmage
Copy link
Owner

Could you try installing ibxtst-dev?

sudo apt-get install ibxtst-dev

I believe this should resolve the issue.

@DamonOehlman
Copy link
Contributor

Ah, you mean libxtst-dev (I assume). Still doesn't work but I'm having a look at the build script and seeing if I can work it out :)

@octalmage
Copy link
Owner

@amih, @DamonOehlman was able to get RobotJS building for Linux and I merged his pull request. Could you try the latest code to see if it works?

@DamonOehlman were there any additional packages needed?

@DamonOehlman
Copy link
Contributor

Nope, xorg-dev was all that was required and I suspect we can get it down to a tighter list also, but I haven't investigated that as yet...

@octalmage
Copy link
Owner

Awesome!

So libxtst-dev wasn't needed after all?

@DamonOehlman
Copy link
Contributor

I think it was, but was brought in as a dependency of xorg-dev. Let me uninstall xorg-dev and I'll try and identify the specific packages that are required.

@DamonOehlman
Copy link
Contributor

OK, I looks like libxtst-dev is the best package to require as a dependency as bringing it in also brings in libx11-dev which is also required. I did however also specify png and z as required link settings as these were expressed as dependencies in autopy.

@octalmage
Copy link
Owner

Great, thanks again for your help. I'll get the readme updated and a new version out tonight. z and png may not be needed now, but they will be necessary dependencies as soon as I finish the screen and bitmap modules.

@octalmage
Copy link
Owner

I'll confirm in a VM and close this out also.

@octalmage
Copy link
Owner

Now I can start with continual integration and unit testing. I'm excited.

@DamonOehlman
Copy link
Contributor

Nice. Note some changes for travis around the new docker containers around installing APT packages but yeah this should be pretty easy to test there :)

@ValerieDittmar
Copy link

I tried building it on my machine under Ubuntu 14.10 and I ran into a dependency issue with a few items:

One was installing npm install nan for node-gyp.

The other dependency I ran across was a libgd-dev error on node-gyp build which prompted:/usr/bin/ld: cannot find -lpng.

sudo apt-get install libgd-dev resolved the /usr/bin/ld: cannot find -lpng message.

@octalmage
Copy link
Owner

In testing with @JohnDittmar we found that some functions don't work on Ubuntu, like keyTap and getPixelColor. These need to be working before I update the readme and close this.

@DamonOehlman
Copy link
Contributor

Sure thing - if I get some more time I'll investigate and see if I can work out what's required.

@octalmage
Copy link
Owner

Same here! I believe one issue is the snprintf function in getPixelColor.

@smmoosavi
Copy link

Is there any solution for node: symbol lookup error: /home/amih3/tmp/node_modules/robotjs/build/Release/robotjs.node: undefined symbol: XGetMainDisplay?

System info:

node v0.12.0
Ubuntu 12.04.1 

Also problem exist for other functions

getMousePos => XGetMainDisplay
typeString => XStringToKeysym
getPixelColor => XOpenDisplay

@octalmage
Copy link
Owner

The Linux build still needs a lot of work, unfortunately I don't know a solution currently. probably missing includes or compiler flags.

@octalmage
Copy link
Owner

Actually, did you try the code in this repository? Or just install using NPM?

@smmoosavi
Copy link

Yesterday I use npm i robotjs.
Now npm i git+https://[email protected]/octalmage/robotjs.git fixed problem. getMousePos and typeString work correctly.
but new buffer overflow problem occurred with getPixelColor explained in #19

@octalmage
Copy link
Owner

Great! I have an idea about getPixelColor, unfortunately it's not convenient for me to work on Linux.

@douglas-larocca
Copy link

For anyone who may have the same issue on debian, X11/extensions/XTest.h is provided by libxtst-dev.

@octalmage
Copy link
Owner

Could someone let me know if this code works with RobotJS from the master branch?

var robot = require("robotjs");

//Press space. 
robot.keyTap("space");

I just added space to keyTap, but I'm unsure if I got the Linux keycode right. See: 523cf3b.

@octalmage
Copy link
Owner

Nevermind! I used my VM to test, and I was wrong. I fixed it in e935825 though.

Finally found the correct keycode in this code:
https://gitlab.com/higan/higan/blob/3ce1d19f7a6890b410f1687ea88759b3aff6a367/ruby/input/keyboard/xlib.cpp#L283

@octalmage
Copy link
Owner

Ok I fixed the issue with gePixelColor #19, but the returned colors seem off.

Could someone double check this?

Thanks!

Edit: I just ran some tests using Ubuntu and every other function works fine. getPixelColor is the last issue, if there is an issue.

@smmoosavi
Copy link

I test it on ubuntu. it works.

$ node index.js  # readme example output.
#c80003 at x:1007 y:474

my os:

Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:    14.04
Codename:   trusty

@octalmage
Copy link
Owner

@smmoosavi Awesome! Does the hex match the screen?

@smmoosavi
Copy link

yes, mouse is on red color when I run js file.

@octalmage octalmage added this to the First Stable Release. milestone Jul 23, 2015
@octalmage
Copy link
Owner

Great! Then it looks like we have full Linux support. I'll close this in a few days, just want to confirm everything is working as expected.

@octalmage
Copy link
Owner

I've done some additional testing and I'm going to consider this closed!

@gasolin
Copy link

gasolin commented Aug 4, 2015

should add a comment in README to help user setup build environment on ubuntu,

sudo apt-get install libxtst-dev libpng++-dev

@octalmage
Copy link
Owner

Yeah for sure, Windows and Mac need instructions also. I'll work on this today.

@johnmarlow007
Copy link

Hi octalmage,
First of all, GREAT PROJECT! I tested it on a windows machine and it works like a charm, but now I am trying to install it on an Ubuntu (zorin) laptop and I got a few error and I got stuck on one.
The last one is:

Error: /home/a/test/robotjs/node_modules/robotjs/build/Release/robotjs.node: undefined symbol: YTestFakeButtonEvent
at Error (native)
at Object.Module._extensions..node (module.js:435:18)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/home/a/test/robotjs/node_modules/robotjs/index.js:1:77)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)

Any idea what can it be?
Sorry if its a stupid one, I am not using linux too much...
Thanks a lot for your efforts!
I am trying to support this project as much as I can.

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

8 participants